woomis Posted October 28, 2004 Share Posted October 28, 2004 I'm working with the Automatic Thumbnail contribution found at http://www.oscommerce.com/community/contributions,1484. I've noticed that the thumbnails generated are in truecolor and are resampled to about 1/15th of the original size of the image. My resulting thumbnails are around 2.5kb. My question is: How can I increase the output quality of the jpegs in this contrib? I would like the resulting thumbnails to be about 6kb. Can someone give me a clue as to what portion in html_output.php I need to edit in order to achieve this? Quote Link to comment Share on other sites More sharing options...
woomis Posted October 28, 2004 Author Share Posted October 28, 2004 The answer lies somewhere in here... if (!isset ($x)) $x = floor ($y * $imagedata[0] / $imagedata[1]); if (!isset ($y)) $y = floor ($x * $imagedata[1] / $imagedata[0]); if ($aspectratio && isset ($x) && isset ($y)) { if ((($imagedata[1]/$y) > ($imagedata[0]/$x) )){ $x=ceil(($imagedata[0]/$imagedata[1])* $y); } else { $y=ceil($x/($imagedata[0]/$imagedata[1])); } } $thumbfile = '/' . basename($image); if (file_exists ($cachedir.$thumbfile)) { $thumbdata = getimagesize ($cachedir.$thumbfile); $thumbdata[0] == $x && $thumbdata[1] == $y ? $iscached = true : $iscached = false; } else { $iscached = false; } if (!$iscached) { ($imagedata[0] > $x || $imagedata[1] > $y) || (($imagedata[0] < $x || $imagedata[1] < $y) && $resize) ? $makethumb = true : $makethumb = false; } else { $makethumb = false; } if ($makethumb) { $image = call_user_func("imagecreatefrom".$types[$imagedata[2]], $image); $thumb = imagecreatetruecolor ($x, $y); imagecopyresampled ($thumb, $image, 0, 0, 0, 0, $x, $y, $imagedata[0], $imagedata[1]); call_user_func("image".$types[$imagedata[2]], $thumb, $cachedir.$thumbfile); imagedestroy ($image); imagedestroy ($thumb); $image = DIR_WS_IMAGES . 'imagecache' . $thumbfile; } else { $iscached ? $image = DIR_WS_IMAGES . 'imagecache' . $thumbfile : $image = substr ($image, (strrpos (DIR_FS_CATALOG . '/', '/'))+1); } return $image; } ?> Quote Link to comment Share on other sites More sharing options...
woomis Posted November 1, 2004 Author Share Posted November 1, 2004 bump Quote Link to comment Share on other sites More sharing options...
sharksalive Posted December 22, 2004 Share Posted December 22, 2004 I'm working with the Automatic Thumbnail contribution found at http://www.oscommerce.com/community/contributions,1484. I've noticed that the thumbnails generated are in truecolor and are resampled to about 1/15th of the original size of the image. My resulting thumbnails are around 2.5kb. My question is: How can I increase the output quality of the jpegs in this contrib? I would like the resulting thumbnails to be about 6kb. Can someone give me a clue as to what portion in html_output.php I need to edit in order to achieve this? <{POST_SNAPBACK}> Just wondering if found a solution? Cheers Nicole Quote Link to comment Share on other sites More sharing options...
radders Posted December 22, 2004 Share Posted December 22, 2004 Are you sure that is the complete code? Normally you'd use this function to specify the image quality: imagejpeg ($dstim , $dst , JPEGQUALITY); Quote Link to comment Share on other sites More sharing options...
mhormann Posted December 22, 2004 Share Posted December 22, 2004 Problem is you can't specify 'quality' with imagecopyresample, and he outputs just the same type as came in, so cannot be sure if it is jpeg (and then use quality factor to save). Just wait for the new one... ;-) [or be sure it's ALL jpegs and then do like radders said] Quote I don't want to set the world on fire—I just want to start a flame in your heart. osCommerce Contributions: Class cc_show() v1.0 – Show Credit Cards, Gateways More Product Weight v1.0 Link to comment Share on other sites More sharing options...
RikR Posted January 9, 2005 Share Posted January 9, 2005 I have a question about this contrib also. Where are the the thumbnail images stored? How can one verify it is working? Quote Rik Rasmussen Link to comment Share on other sites More sharing options...
RikR Posted January 9, 2005 Share Posted January 9, 2005 I installed the files included in the contrib download rather than edit since I had a very fresh install of Milestone 2. However, I can find no directory containing thumbnails. Also, prior to the contrib install, when I uploaded an image for a product, it was saved in the product manufacturers directory inside the images directory. Now, all the uploaded images are going into the images directory. Is this the best place to discuss this contrib? Quote Rik Rasmussen Link to comment Share on other sites More sharing options...
RikR Posted January 9, 2005 Share Posted January 9, 2005 The contrib download includes what appears to be two versions of html_ouput.php to go into the catalog/includes/functions folder. one is html_output.php, the other is html_output_CVS-MS3.php Which of these should be used with Milestone2? Quote Rik Rasmussen Link to comment Share on other sites More sharing options...
RikR Posted January 9, 2005 Share Posted January 9, 2005 It does not seem to me that adding this contrib has actually changed anything. When I view my store I do get small images, but if I right click on the small image, the path is to the big image I uploaded, the file size is that of the big image. The size of the image is small as I have it set in admin, but it does not appear to be a thumbnail. It appears that it is sending the browser the full image and just displaying it smaller. I have looked the the code in the files in my catalog folders to be sure the radder ctrib code is there and it is. What else do I need to do to get the creation of thumbnails to work. Quote Rik Rasmussen Link to comment Share on other sites More sharing options...
RikR Posted January 10, 2005 Share Posted January 10, 2005 I apologize for the confusion, my comments were about Automatic Thumbnail Creator v1.0 http://www.oscommerce.com/community/contributions,841 I will seek help elsewhere. Quote Rik Rasmussen Link to comment Share on other sites More sharing options...
RikR Posted January 11, 2005 Share Posted January 11, 2005 Even though I was working on the wrong contrib here, just in case anyone sees this and wonders, I did get my problem solved. I had to enter a value for the small image width and height in Admin. I was only using the width. Once I did this, Automatic Thumbnail Creator v1.0 works perfect. Quote Rik Rasmussen Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.