Change to correct thumbnail filesize Change to correct thumbnail filesize
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Change to correct thumbnail filesize

Started by jp-photo.dk, September 06, 2007, 09:24:57 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jp-photo.dk

I've made a change in the /include/picmgmt.inc to correct the filesize of thumbnails. I was getting filesizes around 50kb for thumbnails sized 100x50 pixel.

The change only affect ImageMagick conversions.

I've just added a -thumbnail option. The function resize_image is probably also used to resize the real images, and for this to work 100% should only include the -thumbnail if it's really a thumbnail being created. I was thinking in ways of checking against the $thumb_use and only adding -thumbnail if this was either "ht" or "wd". But since I'm not resizing the actual images in my gallery on upload I didn't need it that much.

Old line:
$cmd = "{$CONFIG['impath']}convert -quality {$CONFIG['jpeg_qual']} {$CONFIG['im_options']} -geometry {$destWidth}x{$destHeight} $src_file $im_dest_file";

New line:
$cmd = "{$CONFIG['impath']}convert -quality {$CONFIG['jpeg_qual']} {$CONFIG['im_options']} -thumbnail {$destWidth} -geometry {$destWidth}x{$destHeight} $src_file $im_dest_file";

Nibbler

You can use -thumbnail on intermediate files too. I don't know what version of IM you need for this option, but it should be considered for a future release.