Jump to content
LemmeCheck.Info

reduces image quality?


jjjefersonnn
 Share

Recommended Posts

Anyone knows someway to reduces image quality? (not resize) ....... Its good to save some bandwidth :D

This possible with the thumbnails, but I havent found a way to do it with the images

Edited by jjjefersonnn
Link to comment
Share on other sites

Try this.

  1. Open the file /app/functions.inc.php
  2. On, or about, line #614, locate the following routine:
        if ( $t == 1 )
        {
            $img_src = imagecreatefromjpeg( $sourcefile );
            $img_dst = imagecreatetruecolor( $iw, $ih );
            imagecopyresampled( $img_dst, $img_src, 0, 0, 0, 0, $iw, $ih, $is[0], $is[1] );
            if( !imagejpeg( $img_dst, $destfile, 95 ) )
            {
                exit( );
            }
        }
  3. Change it to this:
        if ( $t == 1 )
        {
            $img_src = imagecreatefromjpeg( $sourcefile );
            $img_dst = imagecreatetruecolor( $iw, $ih );
            imagecopyresampled( $img_dst, $img_src, 0, 0, 0, 0, $iw, $ih, $is[0], $is[1] );
            if( !imagejpeg( $img_dst, $destfile, 90 ) )
            {
                exit( );
            }
        }

    Note the slight difference. The original value is "95" for image quality. In the second example, I changed it to 90.

  4. Save it
  5. Backup your original file, then upload the newly saved one.
  6. You may need to do some trial and error to figure out the best blend of quality versus file size.
  7. Let me know if that works for you. I'm not sure if that's it or not. I just took an educated guess from a quick look, but I think that's where you can change the value of the resampled images.
Link to comment
Share on other sites

Doesnt work..... I tryed to put 

$destfile, 50

to see  a really good change, but nothing happens... the files keep the same size/quality as before

Link to comment
Share on other sites

Hmm, ok, I'll have to look closer -- I'll try to get to it a bit later today. But my guess is one of the routines then in the general functions, perhaps the "Queue" file will have hardcoded image quality values. So you might want to look there.

I would start looking for hardcoded quality settings of 90 to 95 in the files, using searches for things like "truecolor", "resampled", "imagecreate" etc -- the ones that would be local commands for imagemagick

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use, Privacy Policy, and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. policies