|
@@ 700-703 (lines=4) @@
|
| 697 |
|
* @return bool|resource an image resource identifier on success, <b>FALSE</b> on errors. |
| 698 |
|
*/ |
| 699 |
|
private function imagecreatefrombmp($fileName) { |
| 700 |
|
if (!($fh = fopen($fileName, 'rb'))) { |
| 701 |
|
$this->logger->warning('imagecreatefrombmp: Can not open ' . $fileName, array('app' => 'core')); |
| 702 |
|
return false; |
| 703 |
|
} |
| 704 |
|
// read file header |
| 705 |
|
$meta = unpack('vtype/Vfilesize/Vreserved/Voffset', fread($fh, 14)); |
| 706 |
|
// check for bitmap |
|
@@ 707-711 (lines=5) @@
|
| 704 |
|
// read file header |
| 705 |
|
$meta = unpack('vtype/Vfilesize/Vreserved/Voffset', fread($fh, 14)); |
| 706 |
|
// check for bitmap |
| 707 |
|
if ($meta['type'] != 19778) { |
| 708 |
|
fclose($fh); |
| 709 |
|
$this->logger->warning('imagecreatefrombmp: Can not open ' . $fileName . ' is not a bitmap!', array('app' => 'core')); |
| 710 |
|
return false; |
| 711 |
|
} |
| 712 |
|
// read image header |
| 713 |
|
$meta += unpack('Vheadersize/Vwidth/Vheight/vplanes/vbits/Vcompression/Vimagesize/Vxres/Vyres/Vcolors/Vimportant', fread($fh, 40)); |
| 714 |
|
// read additional 16bit header |
|
@@ 731-735 (lines=5) @@
|
| 728 |
|
// in rare cases filesize is equal to offset so we need to read physical size |
| 729 |
|
if ($meta['imagesize'] < 1) { |
| 730 |
|
$meta['imagesize'] = @filesize($fileName) - $meta['offset']; |
| 731 |
|
if ($meta['imagesize'] < 1) { |
| 732 |
|
fclose($fh); |
| 733 |
|
$this->logger->warning('imagecreatefrombmp: Can not obtain file size of ' . $fileName . ' is not a bitmap!', array('app' => 'core')); |
| 734 |
|
return false; |
| 735 |
|
} |
| 736 |
|
} |
| 737 |
|
} |
| 738 |
|
// calculate colors |