PHP generates barcodes related issues

Source: Internet
Author: User
PHP Generated Barcode problem
Official Address Http://www.barcodephp.com/en/userguide

I now want to package this method into a function and then pass the value in, returning the HTML code, such as this string

PHP Code
  function Barcode ($listing) {//Including all required classes require_once (' class/bcgfontfile.php ');        Require_once (' class/bcgcolor.php ');                Require_once (' class/bcgdrawing.php ');                Including the barcode technology require_once (' class/bcgcode39.barcode.php ');                Loading Font $font = new Bcgfontfile ('./class/font/arial.ttf ', 18);        The arguments is R, G, B for color.        $color _black = new Bcgcolor (0, 0, 0);                $color _white = new Bcgcolor (255, 255, 255);        $drawException = null;            try {$code = new BCGcode39 (); $code->setscale (2); Resolution $code->setthickness (30); Thickness $code->setforegroundcolor ($color _black); Color of Bars $code->setbackgroundcolor ($color _white); Color of Spaces $code->setfont ($font); Font (or 0) $code->parse ($listing); Text} catch (ExcePtion $exception) {$drawException = $exception; }/* Here are the list of the arguments 1-filename (empty:display on screen) 2-backgroun        D Color */$drawing = new bcgdrawing (' ', $color _white);        if ($drawException) {$drawing->drawexception ($drawException);            } else {$drawing->setbarcode ($code);        $drawing->draw (); }//header that says it's an image (remove it if you save the barcode to a file) Header (' Content-t                Ype:image/png ');        Draw (or save) the image into PNG format.     $drawing->finish (bcgdrawing::img_format_png); }


------Solution--------------------
1, Bad! This link appears to be corrupted
2 since there is
Header (' content-type:image/png ');

Draw (or save) the image into PNG format.
$drawing->finish (bcgdrawing::img_format_png);
So the poor is the picture data stream

So the work that's generated is your own business.
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.