Magento – Product image not showing into after upload to server – magento-2 data migration

magento-1.9magento2magento2-migration-toolproduct-images

Recently I have migrated the magento-1 (ver: 1.9.1.1) data to magento-2 (Ver: ver: 2.1.7) fress version using data migration tool. And it working perfectly in our local computer (localhost).

I found an issue after upload it to server m2.hiddencamera.com.au that some product image (thumbnail and in details view) not showing instead it showing blank image (http://m2.hiddencamera.com.au/hidden-cameras?cat=84).

Product image showing in localhost

Then I have removed the cache, reindex, upgrade (setup:upgrade, indexer:reindex, cache:clean, cache:flush) using SSH. Even I have flushed Catalog Images Cache for pregenerated product images files from Dashboard -> System -> Cache Management. But no luck.

After inspecting the blank image that the image (url) are not serving from pub/media/catalog/product/cache/ instead it serving from pub/static/. But in localhost all product image source is pub/media/catalog/product/cache/.

Finally, I have contacted with the hosting support about the issue but, unfortunately they failed to fix the issue. They didn't found any error from error log. They also try to solve the issue using setup:upgrade, indexer:reindex, cache:clean, cache:flush etc but no luck.

I am requesting for help from the experts to resolve the issue.

Regards,

Best Answer

I think you have not generated the Static View Files. The static view files refer to the files which are not generated dynamically. These files include images, CSS and JS files. These files are located in the pub/static directory of your Magento 2, and some are cached to the var/view_preprocessed directory as well.

The static view files must be written to the Magento 2 file system using the Command-Line Interface (CLI). To do so, first of all delete caches, sessions & old files that are generated before. To delete caches and sessions, navigate to the following paths and delete everything:

MAGENTO2_ROOT > var > cache > *DELETE ALL*
MAGENTO2_ROOT > var > page_cache > *DELETE ALL*
MAGENTO2_ROOT > var > session > *DELETE ALL*
MAGENTO2_ROOT > var > view_preprocessed > *DELETE ALL*

Also, remove everything including old generated static files from below path except .htaccess file:

MAGENTO2_ROOT > pub > static > DELETE ALL EXCEPT .HTACCESS

Now finally to deploy static view files and re-index the indexers. Run the following CLI commands in Magento 2 root directory:

php bin/magento setup:static-content:deploy

php bin/magento indexer:reindex

This might help you and solve the issue. You can also check out the below blog post and try the other solutions too:

Fix Broken Magento 2 Installation

Related Topic