Author Topic: [solved] How to change thumbnails compression factor?  (Read 2310 times)

Sulpher

  • Beginner
  • *
  • Posts: 22
    • cre:active design lab
[solved] How to change thumbnails compression factor?
« on: July 28, 2009, 14:51:23 PM »
Hello everybody!

I noticed, that Virtuemart generate thumbnails with a 100% compression of .jpeg files which makes thumbnails really big and heavy. For example: 170x170 thumbnail has approximately ~20kb size, but if we with help of Photoshop save this image with 60% jpeg compression, we can get 5kb thumnail in output! So it seems Virtuemart generate thumnails with 100% jpeg compression by default and I'd like to change this parameter manually, since I'm sure - this is very important and it'll be really useful trick for everyone!

Just a little calculation:
20 pics x 20kb per a page = 400kb size.
20 pics x 5kb per a page  = 100kb size.

As you can see, this is very interesting result.

So, I wish I had to adjust this parameter within code manually, so I need expert's advice where to do it.

Cheerz,
Eugene.
cre:active lab - web-design with Joomla!
joomla tune (language team)

Sulpher

  • Beginner
  • *
  • Posts: 22
    • cre:active design lab
Re: How to change thumbnails compression factor?
« Reply #1 on: July 29, 2009, 11:28:43 AM »
Here is the solution:
file class.img2thumb.php
function: NewImgSave()
Line 323 from file beginning:

Code: [Select]
return imagejpeg($new_img, $fileout, 100);
This last parameter 100 is means thumbnail creation without compression. Try to replace it on 60 and thumbnails will get 60% jpeg compression.
cre:active lab - web-design with Joomla!
joomla tune (language team)

felixp

  • Jr. Member
  • **
  • Posts: 192
    • FMCA
Re: [solved] How to change thumbnails compression factor?
« Reply #2 on: July 29, 2009, 14:47:28 PM »
Thank you for following up and posting the solution.
Joomla - 1.5.6
VirtueMart - 1.1.3