| @@ 177-194 (lines=18) @@ | ||
| 174 | // calculate image size |
|
| 175 | $width = ($this->barcode_array['maxw'] * $w); |
|
| 176 | $height = $h; |
|
| 177 | if (function_exists('imagecreate')) { |
|
| 178 | // GD library |
|
| 179 | $imagick = false; |
|
| 180 | $png = imagecreate($width, $height); |
|
| 181 | $bgcol = imagecolorallocate($png, 255, 255, 255); |
|
| 182 | imagecolortransparent($png, $bgcol); |
|
| 183 | $fgcol = imagecolorallocate($png, $color[0], $color[1], $color[2]); |
|
| 184 | } elseif (extension_loaded('imagick')) { |
|
| 185 | $imagick = true; |
|
| 186 | $bgcol = new imagickpixel('rgb(255,255,255'); |
|
| 187 | $fgcol = new imagickpixel('rgb('.$color[0].','.$color[1].','.$color[2].')'); |
|
| 188 | $png = new Imagick(); |
|
| 189 | $png->newImage($width, $height, 'none', 'png'); |
|
| 190 | $bar = new imagickdraw(); |
|
| 191 | $bar->setfillcolor($fgcol); |
|
| 192 | } else { |
|
| 193 | return false; |
|
| 194 | } |
|
| 195 | // print bars |
|
| 196 | $x = 0; |
|
| 197 | foreach ($this->barcode_array['bcode'] as $k => $v) { |
|
| @@ 177-194 (lines=18) @@ | ||
| 174 | // calculate image size |
|
| 175 | $width = ($this->barcode_array['num_cols'] * $w); |
|
| 176 | $height = ($this->barcode_array['num_rows'] * $h); |
|
| 177 | if (function_exists('imagecreate')) { |
|
| 178 | // GD library |
|
| 179 | $imagick = false; |
|
| 180 | $png = imagecreate($width, $height); |
|
| 181 | $bgcol = imagecolorallocate($png, 255, 255, 255); |
|
| 182 | imagecolortransparent($png, $bgcol); |
|
| 183 | $fgcol = imagecolorallocate($png, $color[0], $color[1], $color[2]); |
|
| 184 | } elseif (extension_loaded('imagick')) { |
|
| 185 | $imagick = true; |
|
| 186 | $bgcol = new imagickpixel('rgb(255,255,255'); |
|
| 187 | $fgcol = new imagickpixel('rgb('.$color[0].','.$color[1].','.$color[2].')'); |
|
| 188 | $png = new Imagick(); |
|
| 189 | $png->newImage($width, $height, 'none', 'png'); |
|
| 190 | $bar = new imagickdraw(); |
|
| 191 | $bar->setfillcolor($fgcol); |
|
| 192 | } else { |
|
| 193 | return false; |
|
| 194 | } |
|
| 195 | // print barcode elements |
|
| 196 | $y = 0; |
|
| 197 | // for each row |
|