X-Git-Url: https://git.harvie.cz/?a=blobdiff_plain;ds=sidebyside;f=lib%2FBarcode.class.php;h=6b2ed5613bbf66a3b1adb3c1fb4e98eff132205e;hb=2158110429d1927b2a0f8fc3904a7edab0559e90;hp=72928257ebf7e916ca0f4f4cb4118db2ee093aee;hpb=81ab8aef27da2a93a06296fd3b80cdba3376d956;p=mirrors%2FSokoMan.git diff --git a/lib/Barcode.class.php b/lib/Barcode.class.php index 7292825..6b2ed56 100755 --- a/lib/Barcode.class.php +++ b/lib/Barcode.class.php @@ -37,7 +37,7 @@ class Barcode { static function generate_barcode($string='EXAMPLE', $convert='png', $enctype='code128b') { $string = escapeshellarg($string); $enctype = escapeshellarg($enctype); - $convert = $convert ? " | convert -colorspace gray -background white - $convert:-" : ''; + $convert = $convert ? " | convert - -crop 0x60+0+30\\! -background white -flatten $convert:-" : ''; return shell_exec("barcode -e $enctype -E -b $string$convert"); } @@ -51,7 +51,10 @@ class Barcode { } static function download_barcode($string='EXAMPLE', $convert='png', $enctype='code128b') { - if(self::test()) header('Content-Type: image/png'); else die(); + if(self::test()) { + header('Content-Type: image/png'); + header('Cache-Control: max-age=604800, public'); //1week caching + } else die(); die(self::cached_barcode($string,$convert,$enctype)); } }