forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 modpack by Stramm => Topic started by: gcstate on January 16, 2010, 10:30:20 pm

Title: Thumbnail position - not ceter.
Post by: gcstate on January 16, 2010, 10:30:20 pm
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!
Title: Re: Thumbnail position - not ceter.
Post by: gcstate on January 17, 2010, 01:36:53 pm
anyone??
Title: Re: Thumbnail position - not ceter.
Post by: Stramm on January 17, 2010, 02:40:02 pm
picmgmnt.inc.php

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

for IMageMagick edit the lines below
Code: [Select]
case "im" :
for GD2 the lines below
Code: [Select]
default :

$xOffset and $yOffset are the relevant vars
Title: Re: Thumbnail position - not ceter.
Post by: gcstate on January 17, 2010, 08:56:31 pm
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?
Title: Re: Thumbnail position - not ceter.
Post by: Stramm on January 18, 2010, 05:51:09 pm
after
Code: [Select]
                } else {
                    $ratio = (double)($srcWidth / $thb_width);

are the cases that handle cropping for pics with height < width
Title: Re: Thumbnail position - not ceter.
Post by: gcstate on January 18, 2010, 07:04:29 pm
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 :(
Title: Re: Thumbnail position - not ceter.
Post by: Stramm on January 18, 2010, 08:35:41 pm
Code: [Select]
$yOffset = round(($srcHeight - $cpyHeight) / 2);change to (2 times)
Code: [Select]
$yOffset = 0;
should do (I guess)
Title: Re: Thumbnail position - not ceter.
Post by: gcstate on January 19, 2010, 04:44:14 pm
thank youuu!!
it works :)
SOLVED.