0

Below are four examples of images randomly taken from the Net, two are displaying properly with in custom theme template using <img src="<?php echo $block->getViewFileUrl('publicite1.jpg'); ?>" /> but two others won't be displayed by Magento:

Images not being displayed:

The value in the browser developer tool inspector for these images is <img src="http://www.mywebsite.com/pub/static/version1510292523/frontend/Myvendor/mytheme/en_US/images/publicite1.jpg" style="display: none !important;">

Images being displayed:

What is the problem with these images not being displayed ?

ADDENDUM:

I noticed that it worked after changing the name of one of the images in web/images and in its path in the phtml file, but didn't work again when renaming it to the original name.

It seems the problem is coming from Chrome and Firefox, these images are displaying fine with Safari and Vivaldi. But cleaning the cache of Chrome and Firefox doesn't help. Maybe there's a deep cleaning function somewhere in these browsers ?

  • As per your code it shows that http images are not working but images with source https are working is that right ? – Dhaval Solanki Nov 10 '17 at 5:59
  • Indeed, but what would be the link between the protocol of the websites where images come from and the images itself when they are already downloaded to web/images folder ? – DevonDahon Nov 10 '17 at 6:08
  • you should remove this style="display: none !important;" from <img> – Piyush Nov 10 '17 at 6:19
  • @maxagaz Ohh sorry I thought you are using images from the direct URL. – Dhaval Solanki Nov 10 '17 at 6:24
  • @Piyush I can't remove this style, it comes back as soon as I remove it. – DevonDahon Nov 10 '17 at 6:27
0

The guilty was AdBlock, installed on Firefox and Chrome. After disabling it, everything works fine.

All my images containing for instance ad or advertising were actually blocked by AdBlock by adding the css <style="display: none !important;">.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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