Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Thumbnail Cropping  (Read 5058 times)

0 Members and 1 Guest are viewing this topic.

nickyboi

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Thumbnail Cropping
« on: February 09, 2008, 04:22:53 am »

I was wondering with the thumbnail cropping with the Stramm mod, many fansites use it and when it comes to pictures of the celeb at events the thumbnail just ends up staying at the subjects dress and also makes it hard for a viewer to see what pic we are clicking on. Stramm, is there a way that we can set the coordinates of the X and Y of the thumbnails so it does it for all pics? Like say i want my center to stay at 50 but I want to move my coordinate higher up to get a better thumbnail of my subject. Is there a way for this to be done?
« Last Edit: February 10, 2008, 12:14:21 am by Joachim Müller »
Logged

Stramm

  • Moderator
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Thumbnail Cropping
« Reply #1 on: February 09, 2008, 08:55:43 am »

You could modify the code to reflect what you want to achieve (picmgmnt.inc.php, function resize_image).
However if you upload other types of pics or maybe landscape, cropping wouldn't even take the middle and probably show even worse results. So I'd say it's better to use the manual cropping functionality when a thumb doesn't look as you wish when using auto cropping.

nickyboi

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Thumbnail Cropping
« Reply #2 on: February 09, 2008, 04:52:47 pm »

I actually wouldn't mind that because my site consists of a lot of pictures with the cropping at the waist (thousands of pictures) and doing the manual cropping is too much time consuming. Maybe you can help me modify those two pages so I can achieve what I'm looking for and if I don't like it I can always undo it?
Logged

Stramm

  • Moderator
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Thumbnail Cropping
« Reply #3 on: February 09, 2008, 05:14:41 pm »

if you usr GD2  set in picmgmnt.inc.php
Code: [Select]
$yOffset to 0 (zero)

nickyboi

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Thumbnail Cropping
« Reply #4 on: February 09, 2008, 05:17:46 pm »

Thanks!!
Logged

lostemilie

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 61
Re: Thumbnail Cropping
« Reply #5 on: February 20, 2008, 07:49:44 pm »

I set it like this now:
Code: [Select]
if ($new_size==$thb_width) {
$crop=1;
switch ($CONFIG['thumb_method']){
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;

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 = 0;
           } 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 = 0);
           }
       }
and itīs not working, what did I do wrong?
Logged

lostemilie

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 61
Re: Thumbnail Cropping
« Reply #6 on: February 20, 2008, 07:59:54 pm »

I think it would be perfect instead of 1/4 of the image (where itīs now I think) to 1/8 of the image and not to 0, please someone help me find the line where I can change it
Logged
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 21 queries.