- Web templates
- E-commerce Templates
- CMS & Blog Templates
- Facebook Templates
- Website Builders
PrestaShop 1.6.x. How to fix missing product images issue
February 17, 2015
This tutorial shows how to fix missing product images issue in PrestaShop 1.6.x.
Today we will explain how you can fix empty images issue that occurs in PrestaShop at times. By empty images we imply those pictures which are indexed in the database, but which files are not physically located on server. In such cases users will see a gray question mark instead of a placeholder with the caption that the product image is not available.
There are many reasons that can cause the issue.
Top reasons:
- upgrading to 1.6.x PrestaShop version from the previous one (1.4.x, 1.5.x);
- server settings;
- wrong file location;
- insufficient permissions;
- friendly URL enabled;
- third party modules installed.
To fix missing images issue, please follow the steps below:
-
The first thing you need to check is if the images are really in the location set for the product (we suppose that the image was already checked in the Image tab of your product in the admin).
In order to check the location of your image, you can use Mozilla Firebug Plugin:
When you know the location, check it on your server through FTP or on your hosting cPanel.
If you cannot see the file in the path set for a product, you need to upload your image to exactly the same location. After that your image should appear.
-
If the image still does not appear (though it really exists in the set path), you need to change permissions in img folder to 777, as sometimes the default server permissions 755 for folders and 644 for files are insufficient for the /img/ folder:
-
Another useful thing to do, especially if the question mark images appeared after uploading new images, is regenerating thumbnails.
To do it, you need to log into your admin panel and go to Preferences -> Images section and click Regenerate thumbnails button in Regenerate thumbnails section.
NOTE: regenerating thumbnails can take a lot of hours depending on the number of images you have. Try to choose the good moment to do it:
-
Enabling Friendly URL feature can also bring the problem of missing images for products.
In order to check it, you need to log into your admin panel and go to Preferences -> SEO & URLs and scroll down to Set up URLs section to disable Friendly URL. Sometimes you will need to turn off Redirect to the canonical URL as well:
-
One more widespread reason causing the issue is third party module(s) installed.
So, if you have installed any modules, go to Modules -> Modules in your admin and disable the module(s):
-
The fact that your files cannot be found can be the result of upgrading. The versions below PrestaShop 1.6 use ‘home’ in the string, while PrestaShop 1.6 uses ‘home_default’. Since some of your files can still use ‘home’ as a path and PrestaShop 1.6 has ‘home_default’ instead of it, the files cannot be found because ‘home’ no longer exists. You need to locate all the instances using ‘home’ and replace them with ‘home_default’. Usually, they are /themes/default-bootstrap/product.tpl, product-list.tpl, product-compare.tpl but there can be more files.
We strongly recommend that you back up your files before editing them, so that you can always revert the changes in case something goes wrong:
Please note that upgrade within different lines of versions are not recommended as newest versions have updates of files that can be incompatible with yours and if you still want to do it, back up your database first.
-
Deleting and regenerating the .htaccess file can solve the problem.
In order to do it, delete the .htaccess file from the your root directory on the server using FTP or in cPanel (do not forget to make a backup of the file first) and go to Preferences -> SEO & URLs and scroll down to Set up URLs section. First, set Friendly URL to No and then set it back to Yes:
-
Create a tools.php file in override/classes and paste the following code in it:
{ public static function apacheModExists($name) { return true; } }
If the file already exists, copy-paste the code without the back up first if you modify the existing file.
You may also need to go to SEO URLs to turn them off and on (as described in step 4).
You may also need to clear Smarty cache after saving the changes:
Please note that the above described methods may not always help depending on the circumstances and environment of your PrestaShop site. In this case, we recommend that you visit PrestaShop official forum or/and contact your hosting provider.