Thumbnail position - not ceter. Thumbnail position - not ceter.
 

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 position - not ceter.

Started by gcstate, January 16, 2010, 10:30:20 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

gcstate

Hello

I wanted to ask if there is way to change properties of where coppermine should crop the thumbnails.
Like i always upload a pictures to my gallery, and mostly people heads are cut of the image, because it make the thumbnail from center.

So i wanted to ask if its possible to somehow set up, that when i Upload a picture, it will automatically crop the thumbnails from top or few pixels from top?
I hope you understand what i mean. If not i will post examples.

Thank you!

gcstate


Stramm

picmgmnt.inc.php

find:
$crop=1;
switch ($CONFIG['thumb_method']){


for IMageMagick edit the lines below

case "im" :

for GD2 the lines below

default :


$xOffset and $yOffset are the relevant vars

gcstate

Quote
            default :
                if($srcHeight < $srcWidth)
                {
                    $ratio = (double)($srcHeight / $thb_height);

                    $cpyWidth = round($thb_width * $ratio);
                    if ($cpyWidth > $srcWidth)
                    {
                        $ratio = (double)($srcWidth / $thb_width);
                        $cpyWidth = $srcWidth;
                        $cpyHeight = round($thb_height * $ratio);
                        $xOffset = 0;
                        $yOffset = round(($srcHeight - $cpyHeight) / 2);

                    } else {
                        $cpyHeight = $srcHeight;
                        $xOffset = round(($srcWidth - $cpyWidth) / 2);
                        $yOffset = 0;

                    }

                } else {
                    $ratio = (double)($srcWidth / $thb_width);

                    $cpyHeight = round($thb_height * $ratio);
                    if ($cpyHeight > $srcHeight)
                    {
                        $ratio = (double)($srcHeight / $thb_height);
                        $cpyHeight = $srcHeight;
                        $cpyWidth = round($thb_width * $ratio);
                        $xOffset = round(($srcWidth - $cpyWidth) / 2);
                        $yOffset = 0;

                    } else {
                        $cpyWidth = $srcWidth;
                        $xOffset = 0;
                        $yOffset = round(($srcHeight - $cpyHeight) / 2);

                    }

which ones of the bold ones should i change? i tried to change the 0 to whatever 1 2 7 -5 but nothing works. im lame to all this, can you tell me what should i change and what to put there when i want the thumbs to be cropped from the top of the images?

Stramm

after
                } else {
                    $ratio = (double)($srcWidth / $thb_width);


are the cases that handle cropping for pics with height < width

gcstate

im sorry im total noob to this.
so what should i change  height < width or offsety offsetx ?
i dont care about the width or height of the thumbnail right now (my sizes of thumbnails are okay for me). i just need to make the crop from the top of image not center. see the example attached

please help :(

Stramm

$yOffset = round(($srcHeight - $cpyHeight) / 2);
change to (2 times)
$yOffset = 0;

should do (I guess)

gcstate