ScottC613 Posted January 6, 2023 Share Posted January 6, 2023 Hi there. I'm hoping someone else has had a similar experience and knows how to permanently solve this issue or can give me some details on how the product mini images are assigned. prestashop version 1.7.7.0 all images on the front end as well as the images inside the product listings on the back end are ok. the mini images in the catalogue listing in the back end seem to not be the image of the actual product but of one of the other products instead as if the assignment of the mini image files are being swapped with other products. In the attached screen grab, note that the product mini image is for a different existing product and does not match the image in the screen grab of the product photo from inside the product listing. i can temporarily correct the issue by going to the folder /img/tmp/ and deleting all of the Product_mini_X.jpg files and allowing prestashop to regenerate them however over time it eventually ends up with incorrect images again. Any idea what could be causing this or where something might be reading the wrong data in order to make the incorrect image assignments? Link to comment Share on other sites More sharing options...
TiaNex Shopping Posted January 7, 2023 Share Posted January 7, 2023 maybe you can view the image url and delete the tmp image file ,and it will regenrate a new right one. Link to comment Share on other sites More sharing options...
ScottC613 Posted January 7, 2023 Author Share Posted January 7, 2023 9 hours ago, irder shopping said: maybe you can view the image url and delete the tmp image file ,and it will regenrate a new right one. when i delete them all it seems to regenerate and then eventually get them mixed up. i assume the same would happen if i just deleted specific files. There must be a table or something where it lists what mini images to load for each catalogue item. If it goes by product ID or something maybe something is off or corrupt but then i dont understand why it would regenerate them properly if i deleted the cached ones. you'd think it would make the same mess immediately when they were regenerated but thats not what happens. I wonder if something in the caching system itself could be the problem. Link to comment Share on other sites More sharing options...
TiaNex Shopping Posted January 8, 2023 Share Posted January 8, 2023 the img path is ../img/tmp/product_mini_15_1.jpg?time=1673145264 15 is the product id i am not sure the timestamp is added by me or it's original code, if yours don't have,you can try add a timestamp , it will alway load the new image 1 Link to comment Share on other sites More sharing options...
ps8modules Posted January 8, 2023 Share Posted January 8, 2023 Hi. Do you use a script or module to update products? Product thumbnails are stored in the tmp folder, with the product id in the name. Other images that are in the img/p/ folder are stored in the database in the ps_image table. The thumbnail takes id_image and id_product from this table, where cover = 1 is written in the table. So Prestashop will call Product::getCover function. Link to comment Share on other sites More sharing options...
ps8modules Posted January 8, 2023 Share Posted January 8, 2023 Yes, cache is problem. ImageManager.php /** * Generate a cached thumbnail for object lists (eg. carrier, order statuses...etc). * * @param string $image Real image filename * @param string $cacheImage Cached filename * @param int $size Desired size * @param string $imageType Image type * @param bool $disableCache When turned on a timestamp will be added to the image URI to disable the HTTP cache * @param bool $regenerate When turned on and the file already exist, the file will be regenerated * * @return string|bool */ Link to comment Share on other sites More sharing options...
ScottC613 Posted January 8, 2023 Author Share Posted January 8, 2023 8 hours ago, irder shopping said: the img path is ../img/tmp/product_mini_15_1.jpg?time=1673145264 15 is the product id i am not sure the timestamp is added by me or it's original code, if yours don't have,you can try add a timestamp , it will alway load the new image i checked the image link and it seems to have the time stamp already. product_mini_399.jpg?time=1673175670 Link to comment Share on other sites More sharing options...
ScottC613 Posted January 8, 2023 Author Share Posted January 8, 2023 8 hours ago, prestashopfree.com said: Hi. Do you use a script or module to update products? Product thumbnails are stored in the tmp folder, with the product id in the name. Other images that are in the img/p/ folder are stored in the database in the ps_image table. The thumbnail takes id_image and id_product from this table, where cover = 1 is written in the table. So Prestashop will call Product::getCover function. Initially when the products were added they were imported through store manager. It made a mess of the images initially but i then deleted all the images and reuploaded them manually to correct the issue. The only other modules that i can think of that might touch images would be an seo images module but the problem predates that being installed, and a speed optimization module named Superspeed which can do image compression. I had a look at the PS_image table as well as the files in the images folder and found some odd results Ps_images table: Noted observation - some of the table entries the have various image position numbers but cover set as null is this expected and normal or should this simply be a 1 or 0 value only? located the product ID for one of the effected products by a select query on the product ID SELECT * FROM `ps_image` WHERE `id_product`='476' the result showed the Image ID was 399 with position and cover set as 1 /img/p folder Browsed to /img/p/3/9/9 on the server. Image storage seems to be broken down that each character of the image id is a subfolder. I opened and viewed each image stored in the folder to see if any of these were the wrong image however they all appeared to be the correct images for the product. Image URL the url for the mini image seems to have the correct image id number (399) as well as the timestamp however the image content is a different product. product_mini_399.jpg?time=1673175670 /img/tmp folder Browsed to the above folder and located the product_mini_399.jpg file and opened it and the image seems the be the wrong product. Link to comment Share on other sites More sharing options...
ps8modules Posted January 8, 2023 Share Posted January 8, 2023 Thank you. And product_mini_476.jpg ? This should be a mini image of the 476 product. Link to comment Share on other sites More sharing options...
ps8modules Posted January 8, 2023 Share Posted January 8, 2023 cover = 1 = default image (for each product there should be one image marked as cover) position = position of images in thumbnail list Link to comment Share on other sites More sharing options...
ps8modules Posted January 8, 2023 Share Posted January 8, 2023 When you initially deleted the images, did you also clear the ps_image table in the database? In Advanced Paramteters => Performance did you use Force compilation + Clear cache and had the Superspeed module disabled? Link to comment Share on other sites More sharing options...
ScottC613 Posted January 8, 2023 Author Share Posted January 8, 2023 3 hours ago, prestashopfree.com said: Thank you. And product_mini_476.jpg ? This should be a mini image of the 476 product. i just went and looked in /img/tmp and yes it seems that the product_mini_476 is the mini image that looks correct for product 476. There is also a 476_0 which seems to be a duplicate I also looked in the /img/p/4/7/6/ folder and the images stored there are for a completely different product. very curious how you managed to guess this. Is the image ID in ps_images table supposed to match the product ID? is this an issue of the naming function of the image generator naming the product_mini files incorrectly or a mistake in how the code for the back office sets the image url for the mini images? Link to comment Share on other sites More sharing options...
ps8modules Posted January 8, 2023 Share Posted January 8, 2023 (edited) ./img/tmp/product_mini_ID PRODUCT.jpg ./img/p/3/9/9/399.jpg => ps_image => ID PRODUCT = 476 => ID IMAGE = 399 You keep putting it together. In the TMP folder there is a id product, elsewhere it is id_image !!! Edited January 8, 2023 by prestashopfree.com (see edit history) Link to comment Share on other sites More sharing options...
ScottC613 Posted January 8, 2023 Author Share Posted January 8, 2023 So in effect the product mini should have the same number as the product ID. This makes sense as when i looked at the product mini photo with the same product ID it seemed correct. I wonder how the function that writes the image url in the catalogue page is choosing a product mini that does not match the product ID? Could it be somehow reading the id_image field by mistake somehow and then writing the image url onto the page when it is created? That might explain why the product mini url that is being set matches the image id from ps_images instead of the actual product id. Link to comment Share on other sites More sharing options...
skansa Posted January 15 Share Posted January 15 Hi, I also have a similar problem on my backoffice, the thumbnail of the products that have no image is incorrect (it shows the image of an old product that has been deleted instead of the default "no image"). I tried to delete the image on the tmp, but after the refresh it is regenerated in the same way. Cache cleared and regenerated. The strange thing is the image name that is generated and linked: product_mini_.jpg (without the product ID). What could I do to solve the problem? It is quite annoying to find an untrue image on the back office. Thank you. Link to comment Share on other sites More sharing options...
TiaNex Shopping Posted January 15 Share Posted January 15 hello, if you're in China, you can contact me wx 2281758090 Link to comment Share on other sites More sharing options...
skansa Posted January 15 Share Posted January 15 unfortunately I live in Italy, and I speak little English... Link to comment Share on other sites More sharing options...
ps8modules Posted January 15 Share Posted January 15 Hi. Open Edit product, change cover image, save. Link to comment Share on other sites More sharing options...
skansa Posted January 15 Share Posted January 15 (edited) Thanks for the reply, but it's not a solution for my case. The product images are automatically downloaded from Icecat, but when the products are not present in the Icecat DB no image is downloaded, and Prestashop always offers me the image of a product that no longer exists instead of the usual default image " No Image". The default images are present on /img/p/it-default*.jpg but are not used. How could I solve it? Thank you. Edited January 15 by skansa (see edit history) Link to comment Share on other sites More sharing options...
ps8modules Posted January 15 Share Posted January 15 Hi. Probably like this. Preestashop displays images according to what it has stored in the database. So if the product has image ids stored in the database, it displays them. Give us a screenshot of the product detail page from the administration. If you have a module that downloads images externally, there is an error in it. So far you are giving us piecemeal information here. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now