Cache issue (Images not loading)
-
14-04-2021 - |
سؤال
Despite best efforts, I have images in cache that aren't loading, primarily because they are not present in the cache directory. I have tried clearing the media images cache. Short of deleting all contents of that directory or manually trying to import the images (which I would need to resize to the respective size before importing), I have tried everything to get the images stored in the cache directory. The images were previously loading, but aren't anymore. Does anyone have a solution?
المحلول
There are many things that could be causing this issue, Please look into few things:
- Make sure the product images exist under /media/catalog/product/ (relative to your document root)
On the Product Information page in your admin backend, under 'Images', make sure the radio buttons have an image selected for 'Base Image', 'Small Image', 'Thumbnail', and that they aren't 'Excluded'.
Make sure the /media directory is in your Apache web server's group (usually 'www-data' or 'httpd'). Magento also needs to be able to write to this directory, so you can run this command to set those permissions:
sudo chmod -R 775 /path/to/magento/media
In System->Configuration->General->Web, make sure "Base Media URL" is correct under both "Secure" and "Unsecure.
If this answer is useful Please mark it as solution thanks.
نصائح أخرى
Use below commands for Magento 2 :
- rm -rf var/* generated/* pub/static/*
- php bin/magento setup:static-content:deploy -f
- chmod -R 0777 var/* generated/* pub/static/*
- php bin/magento cache:flush
For Magento 1 :
media folder permission 777
deleted htaccess file under the media folder
clear the cache and full_page_cache
cache folder is writeable
rebuilt all indexes
Hint : https://stackoverflow.com/questions/20074824/magento-not-rebuilding-product-image-cache