Thumbnail img tag size is wrong sometimes Thumbnail img tag size is wrong sometimes
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Thumbnail img tag size is wrong sometimes

Started by utgart, November 11, 2010, 11:09:25 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

utgart

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: First thumb has wrong size, but sizes of second and third are correct.

utgart

Forget the phrase about proportions. Sometimes size become wrong even when proportions are not 2:3.

Αndré

Probably a difference in calculating the new dimensions. Shouldn't happen when thumbnails are created by Coppermine.

utgart

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 :)

Αndré

Quote from: utgart on November 12, 2010, 08:45:17 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'] . '"';
        }

    }