2

I have a problem, I have created a custom module in my Magento site, so in that module I'm calling custom attributes to display some content and images, but when I'm adding media image in this attribute image never shows on the frontend. In inspect element I can saw image in this format. Any suggestion?

<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGP6zwAAAgcBApocMXEAAAAASUVORK5CYII=" data-amsrc="{{media url=" wysiwyg="" img-pages="" 2017device-benefits2.jpg"}}"="" style="margin-bottom:10px;" width="80" height="45" alt="Benefits">

Thank You

4
  • what you are trying to archive? Aug 7, 2020 at 5:19
  • I have a custom product attribute as content and I am inserting media image here. Than I am using that attribute in my custom module to display on frontend. Aug 7, 2020 at 12:23
  • Have you created image attribute for this one? Aug 8, 2020 at 9:31
  • because you image data is wrong. you can revert base64 to png will see
    – xanka
    Oct 15, 2020 at 8:37

2 Answers 2

4

I had the same issue and it is fixed. I saw the image has data-amsrc attribute. it is added by amasty "Google Page Speed Optimizer" module. There is config in admin to ignore images contain certain classes.

in my case, this module also added style display:block to all images in my site. I change config Lazy Load Script => Native JavaScript Lazy Script fixed both issues

hope this helps you

thanks

2
  • That was a problem in my case also, I disable Amasty Lazy Loading and everything works well. Thank you. Apr 22, 2021 at 19:38
  • Thank you. It saved my day. Jan 12 at 18:25
1

Echoing Wenping Guo resolution. We solved the same issue by changing Amasty's Google PageSpeed Optimizer's Image Optimization > Lazy Load > Lazy Load Script from JQuery Lazy Script to Native Javascript Lazy Script resolved the issue for us.

The strange thing for us though was that the issue only affected some of the product images, not all.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.