JamesHeinrich / phpThumb

phpThumb() - The PHP thumbnail generator
Other
315 stars 141 forks source link

PHP Warning: imagecreatefrompng(): gd-png: libpng warning: iCCP: known incorrect sRGB profile in [...]\james-heinrich\phpthumb\phpthumb.class.php on line 3796 on php8.1.2x and php8.2 #221

Closed andymnc closed 3 months ago

andymnc commented 3 months ago

On php 8.1.2x (8.1.28 at the moment) and 8.2.18 When parsing certain png phpthumb is returning this warning: PHP Warning: imagecreatefrompng(): gd-png: libpng warning: iCCP: known incorrect sRGB profile in [...]\james-heinrich\phpthumb\phpthumb.class.php on line 3796 (i hid the full path).

To "fix" it, you can change line 3796 of phpthumb.class.php from: $gd_image = $ImageCreateFromFunctionName($filename); to $gd_image = @$ImageCreateFromFunctionName($filename);

You still have the warning in the error log, but the png image is processed.

JamesHeinrich commented 3 months ago

Sounds reasonable, changed in https://github.com/JamesHeinrich/phpThumb/commit/299ca89857c0072339eb637c29e87cbc55246f27