Advanced search  

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

Pages: [1]   Go Down

Author Topic: Thumbnail position - not ceter.  (Read 5333 times)

0 Members and 1 Guest are viewing this topic.

gcstate

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Thumbnail position - not ceter.
« 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!
Logged

gcstate

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: Thumbnail position - not ceter.
« Reply #1 on: January 17, 2010, 01:36:53 pm »

anyone??
Logged

Stramm

  • Moderator
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Thumbnail position - not ceter.
« Reply #2 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

gcstate

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: Thumbnail position - not ceter.
« Reply #3 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?
Logged

Stramm

  • Moderator
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Thumbnail position - not ceter.
« Reply #4 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

gcstate

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: Thumbnail position - not ceter.
« Reply #5 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 :(
Logged

Stramm

  • Moderator
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Thumbnail position - not ceter.
« Reply #6 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)

gcstate

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: Thumbnail position - not ceter.
« Reply #7 on: January 19, 2010, 04:44:14 pm »

thank youuu!!
it works :)
SOLVED.
Logged
Pages: [1]   Go Up
 

Page created in 0.028 seconds with 19 queries.