4

Magento2 is looking directly in the root folder for media and static files. It is not looking in pub/media folder. Product images are not showing in the front. I installed Magento 2 in a subdirectory and with the installation.

I imported the products with Storemanager Emagicone, images were in import file (in root/media and pub/media because i did not know which to use),

Product images are in the front referring to a wrong path:

/media/catalog/product/cache/1/small_image/400x533/beff4985b56e3afdbeabfc89641a4582/y/o/yorkshire

When I look in FTP, the images are in pub/media/catalog/product. The above-mentioned directory is totally empty.

Moving the files from root/pub/media to root/media solved partially the problem. All basic images show up, but product images are not showing at all.

I already tried:php bin/magento setup:di:compile and php bin/magento setup:static-content:deployand php bin/magento cache:clean and php bin/magento indexer:reindex

The file permissions and user owner are OK, also i deleted all from ROOT > pub > static > EXCEPT .HTACCESS. I also deleted folder in: pub/static var/cache, var/view_preprocessed/css/frontend/ , ..source/frontend

I also looked in di.xml Magento\Framework\App\View\Asset\MaterializationStrategy\Copy

No symlinks!

  • Did you manage to fix this. Please provide the answer. – Stevie G Nov 9 '16 at 10:57
  • Did you check your store configuration? I guess you didnt set your media path or even when, false. – David Lambauer Dec 23 '16 at 20:22
5

For individual product, try saving the product in admin without any change.

For all products, try running the following command (this will take some time to complete):

php bin/magento catalog:images:resize
1

Please make sure to double check owner and group of pub/media directory.

You may run this command from magento root directory:

sudo chown www-data:www-data -R pub/media

Assuming www-data is used as Apache user.

Apache user should have permissions to a pub/media/catalog/product directory to create resized product image files.

Hope it helps.

1

1) Open di.xml from app\etc\di.xml

2) Search by Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink and use word Copy instead of Symlink so the final string will be

Magento\Framework\App\View\Asset\MaterializationStrategy\Copy

3) Save this file and remove everything from pub/static except .htacess

4) Through CMD. Clear your cache 5) Flush your cache 6) Do Reindexing

This time, images should be loaded.

0

I have tried everything but no luck. This article finally helped me fix issue

https://support.magento.com/hc/en-us/articles/115002446014-Product-images-are-not-displayed-although-set-on-the-Product-Edit-page

All you need to do is login to your db via phpMyAdmin (or similar), go to catalog_product_entity_varchar, search for records with value LIKE "no", you will find that few images may have no_selection as their value. Just remove all of those records.

Images should then display correctly

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.