cancel
Showing results for 
Search instead for 
Did you mean: 

Product image not showing on frontend

Product image not showing on frontend

I have added new product on my website (Magento 2.3.4) but the product is not showing on product listing and also not showing on product view page. 

I have done something for it that given below but not fixed yet.

> run upgrade, deploy, indexer and flush command

> Give full permission to pub/media folder

I have found the solution (run bin/magento catalog:images:resize) but I can not run every time after add new product because it's take lot of time and also the image folder size increase rapidly.

 

I have found the issue that is the product image is not added into cache folder.

 

Can anyone please help me.

2 REPLIES 2

Re: Product image not showing on frontend

Hello casadecorj6a3a,

 

Here are some reasons that cause the issue to appear. You can follow the below methods to fix the "Added product image from admin side but not rendering the user side" issue:

 

Low PHP Memory Limit:

 

PHP memory limit plays a vital role in resizing images in Magento 2. Thus, due to the low php memory limit, Magento 2 cannot resize your images and will exhibit placeholder images.

 

Thus, Increase your PHP memory limit to fix the issue,

 

  • Firstly, open the .htaccess file and locate the following string:
php_value memory_limit 256M
  • Next, ensure that the value is at least 256M or better, 512M
  • Lastly, save the .htaccess file if edited the string value.

 

Wrong Attribute scope for small_image, thumbnail, base_image:

 

Oftenly Magento processes images incorrectly if they have scope=Store View, specifically in multi-store installation cases. 

 

  • To fix the issue, you should open your Magento backend > Catalog > Attributes > Manage attributes
  • Next, locate the image, small_image & thumbnail attributes.
  • Then, ensure all the attributes have scope = Global.
  • Lastly, flush all cache in the Admin via the below command,
bin/magento cache:clean

 

 Media Folder Owned by Another User:

 

It can occur if you transfer your Magento store from one server to another. You can fix the issue by changing the ownership of the media folder.

  • Change the ownership of the /media/ folder.
  • You must execute the below code snippet,
chown -R {username}:{username} media/
  • Before changing ownership, ensure that the folder owner is the same user as your web server user.

Wrong Permissions to Folder:

 

The wrong permissions on your /media/ folder can also prompt an error.

  • Firstly, ensure you have writable permissions on this folder. 
  • Next, change permissions to 777 recursively.
  • Now, you can do this using SSH via the below command.
chmod -R 777 media/
  • Lastly, execute it in the Magento directory.

 

The .htaccess file issue in your /media/ folder:

 

If there is a .htaccess file problem in your /media/ folder, it can also be a reason for the issue's occurrence.

 

  • Firstly, navigate to your media folder.
  • Then, rename the actual .htaccess file.
  • Lastly, execute the following command in Linux,

 

cd /media/
mv .htaccess .htaccess1

 

 

I hope the above methods or fixes help you to resolve the "Product image not showing on frontend" issue.

 

----------------------

Regards,

Rex M

 

AccuWeb Hosting | Magento Hosting

Re: Product image not showing on frontend

Did you find any solution..my media/ permission is ubuntu:www-data..Still having same issue