cloudinary / cloudinary_magento2

Cloudinary's Magento 2 extension. Upload product images to the cloud, manipulate them to match your graphic design and optimize images for better user experience
MIT License
15 stars 8 forks source link

Problem with interlaced images #122

Closed Seppo-Konttinen-Solteq closed 1 year ago

Seppo-Konttinen-Solteq commented 1 year ago

Hi.

Our customer uses Cloudinary to store images. I have now noticed with about 10 images that those cannot be added to Magento through admin (Add from Cloudinary) due following error:

An error occured during image insert (baltic_dark_37.5__70cl_pet)! Error: Warning: imagecreatefrompng(): gd-png: libpng warning: Interlace handling should be turned on when using png_read_image in /app/xxx/vendor/magento/framework/Image/Adapter/Gd2.php on line 76

First I asked this from Adobe support and they asked me to install imagick to our Magento Cloud instance. That didn't help and when testing further I noticed that I could add that same image succesfully by first downloading the image to my computer from Cloudinary and using Magento's own image addition button (browse to find or drag image here) in admin. So when using image addition from Cloudinary the error comes.

Do you see any difference between those two approaches? Some how I can't imagine that the image would change between downloading it from Cloudinary to own computer. More problematic this is due the fact that we use Cloudinary module API to fetch images from Cloudinary in PIM integration process.

Thanks in advance.

wissam-khalili commented 1 year ago

Hi @Seppo-Konttinen-Solteq ,

Thanks for reaching out.

In order for me to investigate further, and find the root cause of the described issue, could you please share some additional information?

Any additional information would be greatly helpful.

Looking forward to your reply.

Best regards, Wissam

Seppo-Konttinen-Solteq commented 1 year ago

Hi @wissam-khalili

Your questions reminded me that we were using very old version of module v1.14.5.x-dev. We how ever were updated it to same branch where we do Magento update but that was not yet pushed to staging. So I updated now the newest version 1.19.1to my local and it works well. I push it to staging and do few testings and get back to you for the results.

Seppo-Konttinen-Solteq commented 1 year ago

Actually we had 1.18.0 in staging but I now update that to latest and test.

dannyv-cloudinary commented 1 year ago

Hi @Seppo-Konttinen-Solteq. Wissam is out of office today, so I'll be your point of contact if you need anything. Let us know how your testing goes and if there's anything you need from us.

Thanks, -Danny

Seppo-Konttinen-Solteq commented 1 year ago

Hi @dannyv-cloudinary

Unfortunately it didn't work in Magento Cloud. So must be some differences between my local environment and Magento Cloud. So this seems to be at least also related to configuration that is in Magento Cloud but here is still information what Wissam asked:

Q: Which version of Magento do you have installed on your environment? A: Magento Commerce 2.4.1 running on Magento Cloud

Q: Which version of the Cloudinary module do you have installed on your environment? A: Just updated versions:

Q: Could you share a screenshot of the module's configurations page? A: Yes here

image

Q: Was the issue just recently introduced? Or did you encounter it before as well? A: We just implemented image fetching by using rest/V1/cloudinary/products/SKU/media API when importing product data from Inriver PIM to Magento and we started to investigate why some of the images was not added to Magento and by trying addition by hand in Magento admin we found out this problem

Q: Could you share a link to your Magento store's front site or a specific product page, so I could investigate further? A: We have now manually fixed the images by first downloading the image from Cloudinary and uploading to Magento but this is one of the products that had the issue https://anoraproducts.com/en/1024299

Q: Do you have any additional 3rd party modules installed on your environment? If so, could you please provide a list of these plugins? A: Yes we do, here is the list:

Q: Would you be able to provide our dev team with access credentials to your server (SSH) so they could take a deeper look? A: Unfortunately at least at this point I cannot give access. I am happy to get some logs if you see those useful

dannyv-cloudinary commented 1 year ago

Thanks for your patience while I've looked into this. This actually seems to be an issue with the server that's running your Magento instance, rather than config parameters with the Cloudinary plugin. I think that Adobe's support may have misidentified the issue. In PHP the most common image manipulation libraries are GD and Image Magick. Although Adobe asked you to installImage Magick, the error specifically complains about GD (gd-png) which has the libpng library as a dependency.

Looking at https://sourceforge.net/p/libpng/bugs/165/, the issue you're encountering seems to be a bug that has since been addressed, so updating libpng and/or GD should solve your issue. Would you mind giving that a try please?

Thanks, -Danny

Seppo-Konttinen-Solteq commented 1 year ago

Hi @dannyv-cloudinary

Discussed with Adobe support again. GD version that is in the system is 2.1.0 which does not tell which libpng version there is tho. But they also said, that PHP GD library is used if ImageMagick is not available as a legacy compatibility layer. So I am double checking why error is still thrown from GD while it's checked that ImageMagick is installed in the system and therefore should be used.

If you don't mind for me still asking that you are not directly using DG or ImageMagick in your module? As far as I checked the module it seemed that only Magento's own methods was used and some from the Guzzlehttp.

-Seppo

dannyv-cloudinary commented 1 year ago

Hi @Seppo-Konttinen-Solteq.

I didn't think we used GD or IM directly, but I went and checked the repo directly to confirm. I searched for each of the GD methods and IM methods in this repo, but got no results.

I think it's safe to say we're not calling GD or ImageMagick in the plugin directly.

Seppo-Konttinen-Solteq commented 1 year ago

Hi @dannyv-cloudinary

Thanks for checking. Now I got reply from Adobe that I should upgrade Magento & PHP or remove interlacing from images. So I think this solved is as we are doing the upgrade and this then is solved with that.

Thank you for your help on this.

-Seppo