I have a png which is supposedly corrupt, but still loads in all desktop image viewers, but not php.
The error when calling imagecreatefrompng
is:
Warning: imagecreatefrompng(): gd-png: fatal libpng error: Read Error: truncated data in test.php on line 45
Warning: imagecreatefrompng(): gd-png error: setjmp returns error condition in test.php on line 45
Warning: imagecreatefrompng(): 'test.png' is not a valid PNG file in test.php on line 45
is there anyway of fixing the image in PHP before further processing it? I can fix it by opening it a desktop image viewer and then re-saving as png, but I need to fix any images server side as they come in with this corrupt format.
pngcheck test.png
test.png file doesn't end with an IEND chunk