Oprava prevodu z PS do PNG pro novejsi verzi GNU barcode
[mirrors/SokoMan.git] / lib / Barcode.class.php
index b4231e660bffe34e80671feb01882ae788c7cf9d..b75f2ba9a91031812f65813c5eab839117e87133 100755 (executable)
@@ -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 - -crop 0x60+0+30\\! -background white -flatten $convert:-" : '';
+               $convert = $convert ? " | convert - -crop 0x60+0+30\\! -background none -flatten $convert:-" : '';
                return shell_exec("barcode -e $enctype -E -b $string$convert");
        }
 
@@ -51,7 +51,11 @@ 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();
+               error_reporting(0); //TODO: enable errors again
                die(self::cached_barcode($string,$convert,$enctype));
        }
 }
This page took 0.116643 seconds and 4 git commands to generate.