Thumbnail Issue

Hi folks,



Could I ask how CS-Cart handles thumbnail images on your sites? We have all our images set to be square in admin - product detail images are 200x200px, main images are 600x600px. When the image we upload isn't square, CS-Cart correctly scales it so that the longest dimension is either 200px or 600px and then fills in the rest of the images with a white background to make it the square size. These are then stored in the relevant images folder based on the image size - images/thumbnails/0/200/200 etc.



This seems to be the way it should work and we're happy with this, however we currently have an issue whereby the thumbnail images in a single folder (images/thumbnails/2/200/200) are not being formatted like this. The size is being scaled down to 200px for the longest dimension but no white background is being added to make the image the square size. Therefore when they are displayed on the site, they are being stretched to 200x200px.



When I reported this as a bug with CS-Cart tech support though, they told me that CS-Cart should not work like this and if 2 dimensions are set in thumbnail image setting the images should be stretched to make it the desired size. They have told me I should only have a width or a height dimension set for these to stop them being stretched.



If this is the case, why are all the rest of the images on our site being formatted to the correct size with a white background being added when the images aren't square? I had thought that the problem was just with the images that were being generated in the single folder we have the issue with.



Clearing thumbnails cures the issue for a while but after a day or so thumbnail folder images/thumbnails/2/200/200 is generated and any subsequent thumbnails that are generated appear stretched.



Has anybody else had this issue?



Gordon

I have the exact same problem for a client of mine! CS-Cart told me they never experienced this problem before, so it might be server related.



Do you already have this fixed?



Stefan

I can also vouch for this - a 2.2.5 site on the same server doesn't have this problem, but I have had this problem since 3.0.1 (and still in 3.0.5) on the same server. Something isn't right. Installing CS-Cart 3.0.5 with default demo products doesn't have this problem. If you change any of the additional product images, they appear a right mess.

Forgot to mention. Found this problem in 2 shops now. Version 3.0.3 Professional and 3.0.5 Professional. But not all images get blurry.



As a fix we clear the thumbnails directory daily, but then affiliates have a problem accessing the product thumbnails, we provide through data feeds.



Since it happens daily I thought it might have something to do with the cron job we are running to generate the data feeds.

Here's what CS-Cart did to fix this issue:


[quote]I have applied a new fix to the fn.images.php file located in the core directory of your CS-Cart installation. After that the issue was gone.



Please add this part of code:


if (file_exists($th_path)) {
$size = getimagesize($th_path);

if (!empty($size) && ($size[0] != $width || $size[1] != $height)) {
fn_rm($th_path);
}
}




above this one:


if (!file_exists($th_path)) {




to the fn.images.php file located in the core directory of your CS-Cart installation.

[/quote]