forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 upload => Topic started by: utgart on November 11, 2010, 11:09:25 pm

Title: Thumbnail img tag size is wrong sometimes
Post by: utgart on November 11, 2010, 11:09:25 pm
I use CPG 1.5.8, PHP 5.2.9, GD 2.0.34

I'm creating all sizes (thumb_*, normal_*, *) manually, and upload them by ftp.
After batch adding, IMG tag of some thumbnails have wrong short side size. When long side is always 200px, the short is 133px instead of 134, 134 instead of 135, etc. But when image proportions are not 2:3, then all is ok.
It can be seen here: http://radovar.kiev.ua/thumbnails.php?album=84 (http://radovar.kiev.ua/thumbnails.php?album=84): First thumb has wrong size, but sizes of second and third are correct.
Title: Re: Thumbnail img tag size is wrong sometimes
Post by: utgart on November 11, 2010, 11:12:45 pm
Forget the phrase about proportions. Sometimes size become wrong even when proportions are not 2:3.
Title: Re: Thumbnail img tag size is wrong sometimes
Post by: Αndré on November 12, 2010, 07:42:54 am
Probably a difference in calculating the new dimensions. Shouldn't happen when thumbnails are created by Coppermine.
Title: Re: Thumbnail img tag size is wrong sometimes
Post by: utgart on November 12, 2010, 08:45:17 am
I agree with you, but in 1.4 it didn't happen. I think, 1.4 don't calculate thumbnail size but get it directly from thumbnail. But 1.5 calculates thumbnail size using large (or normal) image size (please correct me if I'm wrong). I think, the first method is better :)
Title: Re: Thumbnail img tag size is wrong sometimes
Post by: Αndré on November 12, 2010, 09:24:19 am
I think, 1.4 don't calculate thumbnail size but get it directly from thumbnail.
cpg1.4.x also calculated it. As far as I can see there's no difference in the calculation, unless you use 'exact' as thumb resizing method:
Code: (include/functions.inc.php) [Select]
$image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width']);
Code: (include/functions.inc.php) [Select]
    } elseif ($thumb_use == 'ex') {

        if ($normal == 'normal') {
            $image_size['geom'] = 'width="' . $image_size['width'] . '" height="' . $image_size['height'] . '"';
        } elseif ($normal == 'cat_thumb') {
            $image_size['geom'] = 'width="' . $max . '" height="' . ($CONFIG['thumb_height'] * $max / $CONFIG['thumb_width']) . '"';
        } else {
            $image_size['geom'] = 'width="' . $CONFIG['thumb_width'] . '" height="' . $CONFIG['thumb_height'] . '"';
        }
        //if we have a system icon we override the previous calculation and take 'any' as base for the calc
        if ($system_icon) {
            $image_size['geom'] = 'width="' . $image_size['width'] . '" height="' . $image_size['height'] . '"';
        }

    }