Call-back icon  Sales: Call 877.832.5289 (N America)|310.295.4144 (International)

Magento

eCommerce Software for Online Growth

Magento Forum

   
Page 2 of 3
Avoid image compression with GD2
 
scree
Sr. Member
 
Avatar
Total Posts:  90
Joined:  2008-07-14
Linz
 

much better would be to extend the method of this class of course…

 
Magento Community Magento Community
Magento Community
Magento Community
 
lisali
Guru
 
Avatar
Total Posts:  454
Joined:  2008-04-28
London, UK
 
scree - 11 September 2008 08:30 AM

Try to change the quality in

/app/code/core/Mage/Media/Model/File/Image.php

on line 168 from

$result imagejpeg($object->getTmpImage(), $object->getFilePath(true), 80);

to

$result imagejpeg($object->getTmpImage(), $object->getFilePath(true), 95);

Great, thanks for this. Best to put this in a local app/code/local… folder to prevent overwriting it when updating. Should be in the GUI backend.
Thanks!!

 Signature 

ExtraCall.com - UK Telecommunications & VOIP

 
Magento Community Magento Community
Magento Community
Magento Community
 
sherrie
Enthusiast
 
Avatar
Total Posts:  861
Joined:  2007-12-14
Illinois, USA
 

Where would this go in the local folder since it’s parent folder is not in the core folder?

 Signature 

Creativity is falling in love with the world. – Dewitt Jones
Current Projects: TECH USA & IHSA State Finals • Currently Running: PHP 5.2.5/MySQL 5.0.45/Magento 1.1.6 on HostGator

 
Magento Community Magento Community
Magento Community
Magento Community
 
lisali
Guru
 
Avatar
Total Posts:  454
Joined:  2008-04-28
London, UK
 

Hi sherrie,

maybe here:

app/code/local/Mage/Media/Model/File

?

 Signature 

ExtraCall.com - UK Telecommunications & VOIP

 
Magento Community Magento Community
Magento Community
Magento Community
 
sherrie
Enthusiast
 
Avatar
Total Posts:  861
Joined:  2007-12-14
Illinois, USA
 

Ohhhh it is in the core folder now, sorry - I totally missed that, I thought we were still talking about the Gd2.php file from before. That’ll teach me to half-read something!

 Signature 

Creativity is falling in love with the world. – Dewitt Jones
Current Projects: TECH USA & IHSA State Finals • Currently Running: PHP 5.2.5/MySQL 5.0.45/Magento 1.1.6 on HostGator

 
Magento Community Magento Community
Magento Community
Magento Community
 
davidn
Jr. Member
 
Total Posts:  15
Joined:  2008-08-14
 

After upgrading to 1.1.6 my image compression settings were overwritten. So following these directions I went back and changed them again. This time though it has no effect. In fact the images are just being crushed, they look really bad. Has anyone else noticed this? Is there another way to adjust the compression?

Thanks
~David

 
Magento Community Magento Community
Magento Community
Magento Community
 
acstudios
Jr. Member
 
Total Posts:  10
Joined:  2008-08-19
 

Any solutions or suggestions on this with version 1.1.6?

 
Magento Community Magento Community
Magento Community
Magento Community
 
TheTwistedOne
Jr. Member
 
Avatar
Total Posts:  7
Joined:  2008-09-20
 

I´m also having problems with this.

The mod described by Scree dosen´t seem to work in version 1.1.6

Help!!! images look terrible!

 
Magento Community Magento Community
Magento Community
Magento Community
 
TheTwistedOne
Jr. Member
 
Avatar
Total Posts:  7
Joined:  2008-09-20
 

Ok, solution found for version 1.1.1 and above including 1.1.6

The code is in /lib/Varien/Image/Adapter/Gd2.php , PLEASE note if you are using 1.1.6 the line to change is 80, NOT 68.

00christian00 - 31 July 2008 05:22 AM

In version 1.1 the code has changed.
To up the quality change the line 68

call_user_func($this->_getCallback('output'), $this->_imageHandler$fileName);

to
if (IMAGETYPE_JPEG === $this->_fileType)call_user_func($this->_getCallback('output'), $this->_imageHandler$fileName,90);
        else 
        
call_user_func($this->_getCallback('output'), $this->_imageHandler$fileName);

90 is my quality,change to your preference.Remember to clear the image cache to test.

Remember 1.1.6 users change line 80

Many thanks to 00christian00 for this fix, you rock!

 
Magento Community Magento Community
Magento Community
Magento Community
 
acstudios
Jr. Member
 
Total Posts:  10
Joined:  2008-08-19
 

Hey TheTwistedOne!  This definitely worked.  Thanks for posting this up!

 
Magento Community Magento Community
Magento Community
Magento Community
 
TheTwistedOne
Jr. Member
 
Avatar
Total Posts:  7
Joined:  2008-09-20
 

@AcStudios, i´m glad it helped.

Full credit should go to 00christian00 for working this one out.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Kasper
Jr. Member
 
Total Posts:  25
Joined:  2007-11-11
Denmark
 

Nice tip, but how would you go about implementing this so that it wont get overwritten when updating magento?

 
Magento Community Magento Community
Magento Community
Magento Community
 
tilzinger
Jr. Member
 
Total Posts:  30
Joined:  2007-12-27
 
Kasper - 07 October 2008 11:48 PM

Nice tip, but how would you go about implementing this so that it wont get overwritten when updating magento?

Create a .txt file in the root of your site that says READMEWHENUPDATING and note the changes you need to make to core files. smile

And yes, a setting like this should most definitely be editable in the Admin area.

 
Magento Community Magento Community
Magento Community
Magento Community
 
doctorlogos
Sr. Member
 
Avatar
Total Posts:  128
Joined:  2008-05-06
 

@tilzinger, this feature in the Admin Area is crucial.

Dear Magento Team, take note!!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
lisali
Guru
 
Avatar
Total Posts:  454
Joined:  2008-04-28
London, UK
 

Agree. We need to be able to customise this in the admin.

Magento applies WEIRD image compressions. Also - has anyone noticed something strange happening when uploading PNG images? For one - their size gets BIGGER (2-3 times) in the frontend. And then there are some transparency issues.

 Signature 

ExtraCall.com - UK Telecommunications & VOIP

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
Page 2 of 3
 
Sales: Call 877.832.5289 (North America) 310.295.4144 (International)
© Copyright 2008 Varien. Magento, eCommerce software, is a trademark of Irubin Consulting Inc. DBA Varien
Privacy Policy|Terms of Service
Magento Community Count
50211 users|546 users currently online|102392 forum posts