diff options
Diffstat (limited to 'inc/polyfill.php')
| -rw-r--r-- | inc/polyfill.php | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/inc/polyfill.php b/inc/polyfill.php index 2b14c4dc..3de6f607 100644 --- a/inc/polyfill.php +++ b/inc/polyfill.php @@ -4,7 +4,8 @@ if (!function_exists('hex2bin')) { function hex2bin($data) { - return pack("H*" , $hex_string); + $hex_string = null; + return pack("H*" , $hex_string); } } @@ -42,7 +43,7 @@ if (!function_exists('imagecreatefrombmp')) { $BMP = unpack('Vheader_size/Vwidth/Vheight/vplanes/vbits_per_pixel'. '/Vcompression/Vsize_bitmap/Vhoriz_resolution'. '/Vvert_resolution/Vcolors_used/Vcolors_important', fread($f1,40)); - $BMP['colors'] = pow(2,$BMP['bits_per_pixel']); + $BMP['colors'] = 2 ** $BMP['bits_per_pixel']; if ($BMP['size_bitmap'] == 0) $BMP['size_bitmap'] = $FILE['file_size'] - $FILE['bitmap_offset']; $BMP['bytes_per_pixel'] = $BMP['bits_per_pixel']/8; $BMP['bytes_per_pixel2'] = ceil($BMP['bytes_per_pixel']); @@ -50,8 +51,8 @@ if (!function_exists('imagecreatefrombmp')) { $BMP['decal'] -= floor($BMP['width']*$BMP['bytes_per_pixel']/4); $BMP['decal'] = 4-(4*$BMP['decal']); if ($BMP['decal'] == 4) $BMP['decal'] = 0; - $PALETTE = array(); - if ($BMP['colors'] < 16777216) + $PALETTE = []; + if ($BMP['colors'] < 16_777_216) { $PALETTE = unpack('V'.$BMP['colors'], fread($f1,$BMP['colors']*4)); } @@ -135,12 +136,12 @@ if (!function_exists('imagebmp')) { $result .= int_to_dword(0); // Number of palettes used (4b) $result .= int_to_dword(0); // Number of important colour (4b) // is faster than chr() - $arrChr = array(); + $arrChr = []; for ($i=0; $i<256; $i++){ $arrChr[$i] = chr($i); } // creates image data - $bgfillcolor = array('red'=>0, 'green'=>0, 'blue'=>0); + $bgfillcolor = ['red'=>0, 'green'=>0, 'blue'=>0]; // bottom to top - left to right - attention blue green red !!! $y=$height-1; for ($y2=0; $y2<$height; $y2++) { |
