cancel
Showing results for 
Search instead for 
Did you mean: 

Product images broken in Magento 2.1.6

Product images broken in Magento 2.1.6

Hello

I have upgraded my store from Magento 2.1.5 to Magento 2.1.6.

Now all my product images shows 404 not found.

 

I have run all commands as well as set 777 permission to pub folder but still its not working.

 

Thanks for your answer in advance.

 

Problem solved? Click Accept as Solution!
Magento Extension Developer | Facebook | Twitter
11 REPLIES

Re: Product images broken in Magento 2.1.6

Same here.
Guess it is a glitch related to the many updates in storefront images and how they are generated then loaded.

My immediate solution is to just Edit each Product that shows in categories (BackOffice > Products > Catalog) and save them right after. No need to change anything, just Edit and Save.

Another solution might be export the whole catalog and import again. Or maybe just these images? No experience there yet.

Hope it helps. Cheers

Re: Product images broken in Magento 2.1.6

I had the same issue.

 

I ran the following to correct the issue:

  php -f bin/magento  catalog:images:resize

 

It took a long time to run, and if you do anything in the admin area while it is running it will fail with a mysql query, simply start command over again and keep running it until it completes without error.

Re: Product images broken in Magento 2.1.6

this may fix my issue in the other thread, i will try it

Re: Product images broken in Magento 2.1.6

I have tried it but still all product cache images shows 404.

Problem solved? Click Accept as Solution!
Magento Extension Developer | Facebook | Twitter

Re: Product images broken in Magento 2.1.6

this worked for my missing category pictures, all i did was put in maintenance mode than run the hours long process of 

magento catalog:images:resize

 

Re: Product images broken in Magento 2.1.6

Thanks tekhullogy! 
Just tested and it fixed the images. The server even got faster. Smiley Very Happy

If anyone wants to know more about what is going on with that command, it's explained at the bottom of this devdoc guide page:
http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/themes/theme-images.html

 

 

Re: Product images broken in Magento 2.1.6

I have similar issue with Magento 2.1.6 (with sample data) on XAMPP on Windows. Folders with image cache are not created at all, and Magento tries to load images from URL like this, for example:

 

http://localhost/xxx/pub/media/catalog/product\cache\f073062f50e48eb0f09af8593e568d857\/w/s/ws01-black_main.jpg 

 

So it looks like the URLs of images are generated incorrectly.

 

Also, when I try to run command:

 

php magento catalog:images:resize

 

 

I get this error:

Unable to write file into directory .../xxx/pub/media/catalog/product\cache\914b1ba9268f5e1d0e58a8e7ce614488\/m/h. Access forbidden.

 

 

 

Re: Product images broken in Magento 2.1.6

I got the same problem with Magento 2.1.6 fresh installation. Finish the import and the product images are all broken. However, if I click on edit and save then the image will show up. I ran bin/magento catalog:image:resize, it ran for a while then stop because of the error. I tried several times with the command, always the error. I don't have this problem with 2.1.5. Does anyone experience the same issue and if you find a solution please help. Thank you.

Re: Product images broken in Magento 2.1.6

I'm certainly not the best person to reply but, I'll try to help.

 

From reading that error I would suppose it is a file permissions error. Maybe the upgrade ran as root or other user that blocked access to some folders. Therefore that error "Unable to write ... Access forbidden."

 

- First I would check the owner and group of all folders and files in Magento. Here is a webpage with fluid details on what to do:
http://devdocs.magento.com/guides/v2.1/comp-mgr/trouble/cman/rc_perms.html

 

Digging a bit more... this command below can show you if there are files under root ownership (you can check other user) in the current folder (like in Magento folder):
sudo find -user root

And this one below could change all files and folders to a particular file system owner:group, usually magentouser:apache, or apache:apache. So check your system and if needed, use it accordingly.
sudo chown -R magentouser:apache .


- After file permissions checked, clear all caches.
- To retry, put the store in Maintenance Mode:
php bin/magento maintenance:enable

- And then run the command again, let it run and finish with the success message:
php -f bin/magento  catalog:images:resize


- Bring back the store from maintenance:
php bin/magento maintenance:disable

 

Go see if the images are back in frontstore.
Hope it helps!
Cheers