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: Thumbnails settings?  (Read 3774 times)

0 Members and 1 Guest are viewing this topic.

SmileyFace

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Thumbnails settings?
« on: May 02, 2011, 04:11:57 pm »

Thumbnails gave me some hard time, so I decided to ask for help.
Basically I want my thumbnails to be all the same height and width, so I used "Exact", however, it stretches and gather images depending on their width.
It's annoying, I want something like this http://selenagomezgallery.com/thumbnails.php?album=119
Help please?
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Thumbnails settings?
« Reply #1 on: May 03, 2011, 11:48:47 am »

Please post a link to your gallery.
Logged

SmileyFace

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: Thumbnails settings?
« Reply #2 on: May 03, 2011, 12:28:09 pm »

No need, I managed to do what I wanted. :)
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Thumbnails settings?
« Reply #3 on: May 03, 2011, 12:34:11 pm »

Resolve your threads
If you have found an answer to your question, resolve your thread. Don't just post "I have found the answer", but tell others what you actually did to solve your issues. Posting a link to the page where you found the answer might help. Describing what you did might help as well. Finally, you can tag your answer as "solved" by clicking on the little image in your initial posting on your thread.
Logged

SmileyFace

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: Thumbnails settings?
« Reply #4 on: May 03, 2011, 03:53:06 pm »

Oh, I'm sorry.
I just logged in tomorrow and it looked fine, however it shows center of the image as thumbnail, is there any way I can make thumbnails show top of the image?
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Thumbnails settings?
« Reply #5 on: May 03, 2011, 04:49:45 pm »

is there any way I can make thumbnails show top of the image?
You have to adjust the following code in include/picmgmt.inc.php:
Code: [Select]
            switch ($CONFIG['thumb_method']) {
                //cropping parameters for ImageMagick
                case "im" :
                    $resize_commands="";
                    if ($srcWidth/$srcHeight > $thb_width/$thb_height) {
                        $resize_commands .= "-resize x".$thb_height;
                        $resized_w = ($thb_height/$srcHeight) * $srcWidth;
                        $resize_commands .= " -crop ".$thb_width."x".$thb_height."+".round(($resized_w - $thb_width)/2)."+0";
                    } else {
                        $resize_commands .= "-resize ".$thb_width;
                        $resized_h = ($thb_width/$srcWidth) * $srcHeight;
                        $resize_commands .= " -crop ".$thb_width."x".$thb_height."+0+".round(($resized_h - $thb_height)/2);
                    }
                    break;

                // cropping parameters for GD2
                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);
                        }
                    }

                    $destWidth = $thb_width;
                    $destHeight = $thb_height;
                    $srcWidth = $cpyWidth;
                    $srcHeight = $cpyHeight;
                    break;
            }

If you're using GD2 to create your thumbnails, you'll have to change the second occurrence of
Code: [Select]
$yOffset = round(($srcHeight - $cpyHeight) / 2);to
Code: [Select]
$yOffset = 0;
Logged

SmileyFace

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: Thumbnails settings?
« Reply #6 on: May 16, 2011, 10:14:47 pm »

I've messed something up, is there any way to get picmgmt.inc.php any how? I deleted something from it and now it doesn't work. :/
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Thumbnails settings?
« Reply #7 on: May 17, 2011, 09:38:01 am »

It's in the official package you can download here. Alternatively you can download the cpg1.5.12 version from our svn repository.
Logged

SmileyFace

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: Thumbnails settings?
« Reply #8 on: May 19, 2011, 04:49:33 pm »

Thanks, it worked. And big thank you for everything else.
Logged
Pages: [1]   Go Up
 

Page created in 0.021 seconds with 20 queries.