CodeIgniter Forums
ErrorException imagecreatefrompng() - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: ErrorException imagecreatefrompng() (/showthread.php?tid=81034)



ErrorException imagecreatefrompng() - hosterfy - 01-17-2022

Hello,

I publish this issue, because there is an error when we try to import into a form a PNG image. The issue occurs only for PNG images, not for JPG.

ErrorException
imagecreatefrompng(): gd-png: libpng warning: Interlace handling should be turned on when using png_read_image

You can see it on this screenshot : https://prnt.sc/26et5v1

The impacted PHP version is 7.4.27 (all required extensions installed like GD, ImageMagick, etc. But when i change to PHP version 7.3.33 all is working.

I really don't understand why there is this issue only on 7.4 and above PHP version..

Also, i checked the above code, the image is properly uploaded but the CI code part is impacted by this issue :


PHP Code:
foreach($data['files'] as $file){
 
$edit_image = \Config\Services::image()
 
        ->withFile($file["file"])
 
        ->fit(400400'center')
 
        ->save($file["file"]);         
 
}
 
$avatar $file["name"]; 


Sorry about my bad english.

Thanks in advance.



RE: ErrorException imagecreatefrompng() - kenjis - 01-18-2022

I don't know this article is correct or not, but for your information:
PNG – deactivate interlace to avoid ‘libpng warning: Interlace handling should be turned on when using png_read_image’ – mixable Blog
https://mixable.blog/png-deactivate-interlace-to-avoid-libpng-warning-interlace-handling-should-be-turned-on-when-using-png_read_image/


RE: ErrorException imagecreatefrompng() - hosterfy - 01-18-2022

Hello,
Thanks for your reply, and yes i already see that, but the issue is CI side / configuration, because this function is a lib into CI.
Thanks.


RE: ErrorException imagecreatefrompng() - Eko - 06-17-2022

Got the same problem. Is it any way to fix this?