Solved: Magento 2 product images not showing in frontend or backend

by admin

Are you facing a problem where your Magento 2 product images not showing up on the front of your online store? Don’t worry, it happens. This guide is here to help you figure out why it’s happening and how to fix it. We’ll walk you through simple steps to get those product images back and make your Magento online store look great again. 

Solution for Magento 2 product images not showing

After surveying and reviewing common customer problems, we found that there are 2 main problem cases:

Case 1: Magento 2 product images not showing in frontend

Reason 1: You have mistaken permissions on your /media/ folder

The first reason make Magento 2 product images not showing in frontend can related to mistaken permissions.

Make sure you have the right permissions for specific folder. Set the permissions to 777 by using this command in your Magento directory through SHH:

> chmod -R 777 media/

This will give you the necessary access and resolve any permission issues. 

Reason 2: Media folder is owned by another user

If you’re experiencing issues with your Magento store’s images after transferring them to a new server, the problem might be related to ownership. To fix this, change the ownership of the /media/ folder using the following command: 

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

It’s crucial to ensure that the folder owner matches the user of your website server. If you are unsure about the correct user, get in touch with your server support administrator for assistance. This simple adjustment should resolve the image display problem on your Magento store.

Reason 3: There’s an issue with the .htaccess file in your /media/ folder

To fix this issue, go to the /media/ folder and rename the original .htaccess file using this Linux command:

cd /media/
mv .htaccess .htaccess1

This can address problems related to the .htaccess file and help display your media files properly in your Magento store 

Reason 4: Low PHP memory limit lead to images cannot be resized

When Magento encounters insufficient memory for resizing images using the GD library, it defauts to a placeholder image, leading to Magento 2 product images not showing in frontend. To resolve this, increase your memory limit by opening your .htaccess file. Locate the line:

php_value memory_limit 256M

Make sure that it’s set to at least 256M, or better yet, 512M. 

Reason 5: The GD library is not installed or configured

To ensure proper functionality, confirm that the GD library is installed on your hosting server. You can verify this by checking your php infor

Reason 6: Wrong attribute scope for small_image, thumbnail, base_image

If Magento 2 product images not showing in frontend with the scope set to “Store View”, in multi-store installations, you can resolve this issue by adjusting attribute settings. 

In your Magento backend, navigate to Catalog > Attributes > Manage Attributes. Locate the image, small_image, and thumbnail attributes, ensuring that their scope is set to “Global”. This step ensures proper image processing and resolves any related issues. 

Reason 7: no_selection values for image, small_image, thumbnail, swatch

In addition, Magento 2 product images not showing in frontend can be due to no_selection values for some elements. To address the issue of product images not displaying correctly due to an official bug related to improper synchronization between a specific store and the Global store settings, you can resolve it by deleting attributes with “no_selection” values. Execute the following SQL script:

DELETE `cpev_s`.*
FROM `catalog_product_entity_varchar` `cpev_s`
JOIN `eav_attribute` `ea` ON `cpev_s`.`attribute_id` = `ea`.`attribute_id`
LEFT JOIN `catalog_product_entity_varchar` `cpev_0`
   ON `cpev_0`.`row_id` = `cpev_s`.`row_id`
   AND `cpev_0`.`attribute_id` = `cpev_s`.`attribute_id`
   AND `cpev_0`.`store_id` = 0
WHERE `cpev_s`.`value` = 'no_selection'
   AND `ea`.`attribute_code` IN ('image', 'small_image', 'thumbnail')
   AND `cpev_s`.`store_id` > 0
   AND `cpev_s`.`value` != `cpev_0`.`value`
    AND `cpev_s`.`value` = 'no_selection';

Reason 8: Problem with safe mode

As a last resort, if all other solutions fail, you can consider disabling safe mode on your server. Keep in mind that this is generally not recommended due to potential security risks, so explore alternative solution first. 

Reason 9: Out of date static content

For this issue, consider to regenerate your static content with the following command:

php bin/magento setup:static-content:deploy -f <locale>

To find your store’s <locale> code, run:

php bin/magento info:language:list

Select a locate code from the list that corresponds to your store. 

Case 2:  Magento 2 product images not showing in backend

Magento 2 product images not showing in backend due to incorrect permissions on uploaded files. Open the file lib/Varien/File/Uploader.php and ensure the following permissions are set:

Around line 219:

chmod($destinationFile, 0666);

Around line 541:

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

Note: Alternatively, applying patch SUPEE-7405 v1.1 can also resolve this issue.

Suggestion for optimizing your images simplest 

Images are one of the most important pieces of content on your website, and optimizing them is extremely important. Thus, optimize your images is a crucial way to reduce problem that Magento 2 product images not showing in frontend.

To optimize your images in the simplest way, our list of extensions below is the solution for you. We provide these suggestions will help improve your store which minimize the number of cases Magento 2 product images not showing in frontend.

 

Extension 

Highlight features

Compatible 

Price

Magento 2 Custom Option Image 

custom_option
  • Add an image to each value in a drop-down, radio button, checkbox, multiple select “custom option” box.
  • Support swatch image for options type dropdown and radio button.
  • Adjust the image size of the selected custom options type.
  • Work with simple, configurable, bundle (without dynamic pricing), downloadable and virtual products.

Magento 2.3.x – 2.4.x

$89.00

Magento 2 Bundle Product Option Image 

bundle_option

  • Display images of children products in options of bundle products
  • Display images of children products in a slider with multiple select input type
  • Set width and height for images
  • Be compatible with Magento sites even when themes are customized
  • Improve visual for your bundle product
  • Grown user’s experience and brand loyalty
  • Increase product sales and revenue

Magento 2.3.x – 2.4.x

$79.00

Magento 2 Product Images by Customer

magento_2_product_images_by_customer

  • Registered users and guests can upload their product images to Magento websites
  • Notification emails are sent to admin when customers upload images
  • Manage uploaded images in a grid table and allow admin to perform mass actions: Approve/ Disapprove/ Delete
  • Control the display of approved images in a stunning slider

Magento 2.3.x – 2.4.x

$35.00

Magento 2 Convert Images to WebP 

convert_images_to_webp
  • Automatically convert jpg, png, and jpeg images to Webp for faster website loading.
  • Choose conversion locations like Product Page, Category Page, and more.
  • Save time with automated media conversion for attractive images.
  • Convert child items’ images of configurable products automatically.
  • Support images uploaded through Page Builder for seamless conversion.
  • Ensure compatibility with all browsers, including Safari 14.1 and above.

Magento 2.3.x – 2.4.x

$59.00



We hope these suggestions will help improve your store.

Wrap-up

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 2 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. 

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

 

NEW: We have launched Trello’s Product Roadmap to keep you updated on our latest product versions. Share your feedback and suggestions for Magento solutions to help us improve your experience here. With our Product Roadmap, you can also request updates or compatibility for your desired modules or suggest a new one to enhance your website.

>>
Explore NOW! 

Next Reading Suggestions

© 2019 BSS Commerce owned by THANH CONG INTER ., JSC. All Rights Reserved.
Business registration certificate no. 0106064469 issued by Hanoi Department of Planning and Investment on 19 December 2019.
Legal Representative: Mr. Nguyen Quang Trung.