cancel
Showing results for 
Search instead for 
Did you mean: 

Image not showing on front end (but shows in back end)

Image not showing on front end (but shows in back end)

Hi,

 

I have uploaded products to my M2 site using Excel however I am having issues with images.

 

The images show in the back end but not on the front end. If you hover over the image or click on it (in the front end) the image shows. For the image role, I have selected all of them (Base, Small, Thumbnail, Swatch).

 

Sample product with this issue: https://id-workz.co.uk/powerflex-bush-kit-handling-pack-for-audi-tt-8n-2wd-99-06/

 

Any help would be great!

5 REPLIES 5

Re: Image not showing on front end (but shows in back end)

It is a common issue in Magento. After uploading images from back end, the images are shown in back end, but are not displayed on the front end. To solve follow the below steps. Any one of them might solve the issue for you, or even you might need to apply all.

Try your luck here

 

Solution


1. In back end go to System -> Cache Management. Click all check boxes. Choose ‘Refresh’ option from ‘All Cache’ drop down. Click ‘Save Cache Settings’. Once the page reloads select ‘Disable’ from drop down and again press ‘Save Cache Settings’.

 

2. On the same page you will find a button ‘Clear’ beside ‘Images Cache’. Click it.

 

3. Go to Catalog -> Manage Products. Click the specific product. Go to ‘Images’ tab. Beside the image there will be 3 radio buttons (Base Image, Small Image, Thumbnail). See if the required radio is selected or not. Also check if Exclude is checked or not. If checked uncheck it and save product.

 

4. Upload another image. Assign all radio to that image. Save the product. Then reassign the required radio options to the actual image and save again. And yes also clear your browser cache. I hope by now the image is showing in front end.

 

The problem might be because of folder permission. You can try giving 777 permission to media folder and all its sub directories and see if it does any help.

 

Goto to your cache folder and rename it to _cache, then go and refresh all cache management and refresh all caches.

 

I encountered this issue when I transferred magento files from dev environment to production site. The production environment is hosted on Godaddy. After trying couple of things like making the media folder to 0777 permissions, clearing cache etc. I still got this annoying error.

 

I’ve been spending a couple of hours trying to solve the issue until I found out that the simple solution is to delete the .htaccess file under the media folder.


if you are using a Linux server just do the following command

 

cd /media/
mv .htaccess .htaccess—

 

I hope after applying all the solution you an able to see the images on frontent if still faing same issue the it needs to run resize command

 

Php bin/magento catalog:images:resize

Try this.

Re: Image not showing on front end (but shows in back end)

Finally 

 

php bin/magento catalog:images:resize

 

this commend will works thanks 

Re: Image not showing on front end (but shows in back end)

Hello idrees_shafique,

 

If you are using the Magento platform for your e-commerce website, you might have encountered the not showing a product image issue on the user side.

 

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

 

 Media Folder Owned by Another User:

 

It can happen 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 cause 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, then it can also be a reason for the issue's occurrence.

 

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

 

cd /media/
mv .htaccess .htaccess1

Low PHP Memory Limit:

 

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

 

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, especially 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

 

I hope the above methods or fixes help you to fix the "not showing product image on the user side." issue.

 

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

Regards,

Rex M

 

Problem solved? Click Accept as Solution!

 

AccuWeb Hosting | Magento Hosting

Re: Image not showing on front end (but shows in back end)

Try this:

php bin/magento catalog:images:resize
php bin/magento indexer:reindex

Re: Image not showing on front end (but shows in back end)

Please check

pub/media/.htaccess

this file is exit or not, if not in the folder you need to undo it. if you have git please run this commend:

git checkout pub/media/.htaccess

It's  works for me.