forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 modpack by Stramm => Topic started by: nickyboi on February 09, 2008, 04:22:53 am

Title: Thumbnail Cropping
Post by: nickyboi 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?
Title: Re: Thumbnail Cropping
Post by: Stramm 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.
Title: Re: Thumbnail Cropping
Post by: nickyboi 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?
Title: Re: Thumbnail Cropping
Post by: Stramm on February 09, 2008, 05:14:41 pm
if you usr GD2  set in picmgmnt.inc.php
Code: [Select]
$yOffset to 0 (zero)
Title: Re: Thumbnail Cropping
Post by: nickyboi on February 09, 2008, 05:17:46 pm
Thanks!!
Title: Re: Thumbnail Cropping
Post by: lostemilie 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?
Title: Re: Thumbnail Cropping
Post by: lostemilie 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