From fced16a840e0156218a0470f0cd6e9ee21580fbd Mon Sep 17 00:00:00 2001 From: "Rebecca G. Bettencourt" Date: Mon, 20 Feb 2023 23:29:36 -0800 Subject: [PATCH] Update README.md --- README.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3f755b7..50aa6fc 100644 --- a/README.md +++ b/README.md @@ -13,16 +13,28 @@ include 'barcode.php'; $generator = new barcode_generator(); /* Output directly to standard output. */ +header("Content-Type: image/$format"); $generator->output_image($format, $symbology, $data, $options); -/* Create bitmap image. */ +/* Create bitmap image and write to standard output. */ +header('Content-Type: image/png'); $image = $generator->render_image($symbology, $data, $options); imagepng($image); imagedestroy($image); -/* Generate SVG markup. */ +/* Create bitmap image and write to file. */ +$image = $generator->render_image($symbology, $data, $options); +imagepng($image, $filename); +imagedestroy($image); + +/* Generate SVG markup and write to standard output. */ +header('Content-Type: image/svg+xml'); $svg = $generator->render_svg($symbology, $data, $options); echo $svg; + +/* Generate SVG markup and write to file. */ +$svg = $generator->render_svg($symbology, $data, $options); +file_put_contents($filename, $svg); ``` Use with GET or POST: