Challenge with .png graphic uploads - causing error "(An unexpected error occurred: #1414) self.parent.reloadIframe('teaser_graphic_iframe')self.parent.hideModal();"

6 posts by 2 authors in: Forums > CMS Builder
Last Post: March 30, 2022   (RSS)

By Codee - March 25, 2022 - edited: March 28, 2022

Greetings all,

Using CMSB ver 3.55 build 2297. Php 7.4.28.  When I upload .png graphic files I get the error "(An unexpected error occurred: #1414)
self.parent.reloadIframe('teaser_graphic_iframe')self.parent.hideModal();"  -- EVERY TIME.  The image still uploads, though.  This does not happen when I upload a .jpg image.  I am NOT utilizing the webp conversions nor media library.

Screenshot attached. 

Developer log shows " #1417 - E_WARNING: imagecreatefrompng(): gd-png: libpng warning: Interlace handling should be turned on when using png_read_image
/home/airway5/public_html/acPOdmin518/lib/image_functions.php (line 39)
https://airwaycenter.com/acPOdmin518/admin.php"

FYI: If I turn on "WebP" then the error above stops.

Thank you for any assistance.

Attachments:

png-error-uponupload.jpg 102K

By Codee - March 29, 2022 - edited: March 29, 2022

Hi Daniel,

I am attaching several of the actual .png files that errored (but still uploaded and were visible) as requested.  HOWEVER, let me state what has occurred in the interim. I engaged the WebP option on this particular site and the errors ceased. SO, I turned webp back off and ran some tests -- the same .png files that were previously having problems...no longer do.

So, I went to a 2nd site that I also recently updated. This one is the most recent version of CMSB 3.56 (build2304) - the next version after the first site mentioned (3.55, bld 2297).  Upon uploading the very same .png (with webp off) files (ANY .png actually) causes the same error mentioned earlier.  If I then turn webp on, the .png error goes away (and using same files). Then turn webp off, remove cookies and temp files and open new browser, then upload a .png and get the error again. I can then turn webp on, no error. Turn off, error. Back on, no error...Consistently.  If you need a temp login to that particular site, let me know and I'll provide one.

My plan, of course, is to run webp "on" moving forward and there's no apparent error when I do turn it on.  But it's a tad concerning that before webp is turned on the error for .png uploads occurs (and these sites have both been on board for several years and not had these errors before). 

Thank you.

By daniel - March 30, 2022

Hi Codee,

Thanks for the additional info. A curious issue to be sure - uploading those images to my test environment doesn't produce any errors, so it points to something related to the specific libraries available on the server. Could you test out the following patch for me? In /cmsb/lib/image_functions.php, replace this line (at or around line 42):

case IMAGETYPE_PNG:  $sourceImage = imagecreatefrompng($sourcePath); break;

With this:

case IMAGETYPE_PNG:  $sourceImage = @imagecreatefrompng($sourcePath); break;

This should hopefully silence the error. As the image still uploads correctly, that may be sufficient.

Thanks,
Daniel

Daniel
Technical Lead
interactivetools.com

By Codee - March 30, 2022

done. Thanks, Daniel. I noticed the .jpg was already set to suppress jpeg errors. Is that how the core file is supposed to be set?

By daniel - March 30, 2022

Hi Codee,

Yes - it appears there was a similar issue that came up related to uploading invalid JPEGs. We prefer to resolve error messages without silencing them, but sometimes it is unavoidable!

Daniel
Technical Lead
interactivetools.com