Best Solutions To Fix Magento 2 Images Not Showing Issue

In this article, we will help you solve the problem of Magento 2 images not showing in just some simple steps.

If you are facing the problem that your images don’t display on your Magento 2 website, then you are at the right place.

There are some reasons that cause the issue to occur. And below, we will check all the points in depth.

Let’s go!

Best Solutions To Fix Magento 2 Images Not Showing Issue

There can be two cases of the problem:

  • Case 1: Image doesn’t display in front-end but displays in admin
  • Case 2: Image doesn’t display in admin

Image doesn’t display in front-end but displays in admin

Reason 1: You have mistaken permissions in your /media/ folder.

The solution regarding this point is that please check whether writable permission is given on this folder or not.

Change the permission to 777.

You can do this using SSH through this command.

chmod -R 777 media/

Reason 2: Media folder is owned by another owner.

It happens when switching Magento from one server to another.

The best solution is to change the ownership of /media/ folder.

You can do it by executing the code snippet below.

chown -R {username}:{username} media/

Note: Before switching, make sure the owner of the folder is the same as that of the web server user. If not, please contact your server guy for their support regarding ownership.

Reason 3: Low PHP memory limit.

PHP memory limit plays an important role in resizing images in Magento 2.

Due to the low memory limit, Magento 2 cannot resize your images and will display placeholder images.

The solution for this is to increase your PHP memory limit.

Access the .htacess file. and find the given string below.

php_value memory_limit 256M

The value should be at least 256M and better be higher than 512M.

Reason 4: The GD library is not installed or configured.

The solution is to check with the hosting provider as they have installed the GD library on the server. 

Image doesn’t display in admin

Mostly, it happens due to wrong permissions set to uploaded files.

To fix it, open lib/Varien/File/Uploader.php.

Check if the permission is set or not.

Around line 219:

chmod($destinationFile, 0666);

Around line 541:

if (!(@is_dir($destinationFolder) || @mkdir($destinationFolder, 0777, true))) {

The Best Solution To Optimize Your Images

Needless to say, product images are such a crucial component of your Magento 2 store. However, depending on how you use your images, they can benefit or harm your website.

And the size of your images is a noteworthy aspect. It affects the website design, SEO and conversion rates.

Thus, you should keep all images on a single page to a total of 1 MB or less.

And to do it, it is recommended to use the WebP format to optimize the image size. WebP format can maintain the image’s quality but compress it to be around 30% smaller.

And hereby, we want to introduce you to the best solution to convert your product images to WebP format:

Magento 2 Convert Images to WebP by BSS

magento-2-convert-images-to-webp

This extension allows you to convert all product images on your website to the WebP format with only a few clicks.

It also allows you to choose to change the image format on some specific page. For example, you can choose to convert images on the home page, product page, category page, or CMS page.

You can choose not to convert some specific images, too.

Highlight features: 

  • Automatically convert images under other formats (e.g., jpg, png, jpeg) to Webp to optimize the loading and display speed of your website.
  • Choose specific places you want to convert your images to WebP format: All, Product Page, Category Page, Home Page, CMS Page.
  • Reduce time spent on conversion, automate every media upload, and deliver better-looking images.

Conclusion

In this article, we have pointed out some reasons that lead to the issue of Magento 2 images not showing and how to fix them.

We hope this blog is helpful and good luck to you!

BSS Commerce is one of the leading Magento extension providers and web development services in the world. With experienced and certified Magento developers, we commit to bringing high-quality products and services to optimize your business effectively. Furthermore, we offer FREE Installation – FREE 1-year Support and FREE Lifetime Update for every Magento extension.

CONTACT NOW to let us know your problems. We are willing to support you every time.

Posts

Writing is a part of my life and I'm living for it.

Write A Comment

Name