Mail Index


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ApacheGallery] Need help! Thumbnail sizes (Fix)



After the initial rush of no help whatsoever, I decided to take matters into
my own hands. Here is the modified sub get_thumbnailsize, which actually
makes use of both thumbnail width and height settings:


### START CODE ###
sub get_thumbnailsize {
 my ($r, $orig_width, $orig_height) = @_;

 my ($thumbnailwidth, $thumbnailheight) = split(/x/,
($r->dir_config('GalleryThumbnailSize') ?
$r->dir_config('GalleryThumbnailSize') : "100x75"));

 my $width = $thumbnailwidth;
 my $height = $thumbnailheight;

 my $scale = ($orig_width ? $width/$orig_width : 1);

    if ($orig_height) {
        if ($orig_height * $scale > $thumbnailheight) {
            $scale = $height/$orig_height;
            $width = $orig_width * $scale;
        }
    }

 $height = $orig_height * $scale;

 $height = floor($height);
 $width  = floor($width);

 return ($width, $height);
}
### END CODE ###


david