chelbeh
11/3/2015 - 11:58 AM

Создать баркод

Создать баркод

 $resolution = 10;
        $code = '8912345227369';
        $font = dirname(__FILE__).'/../../font/arial.ttf';

        $im = imagecreatetruecolor(70 * $resolution, round(29.7 * $resolution));

        $black = imagecolorallocate($im, 0x00, 0x00, 0x00);
        $white = imagecolorallocate($im, 0xFF, 0xFF, 0xFF);
        imagefilledrectangle($im, 0, 0, 70*$resolution-1, round(29.7*$resolution)-1, $white);
        Barcode::gd($im, $black, 35*$resolution, round(18*$resolution), 0, 'ean13', array('code'=>$code), round(0.4*$resolution), round(7*$resolution));
        imagefttext($im, round(2.6*$resolution), 0, round(21.5*$resolution), round(25*$resolution), $black, $font, $code);
        imagepng($im);