Thumbnail Cropping Thumbnail Cropping
 

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]

Main Menu

Thumbnail Cropping

Started by nickyboi, February 09, 2008, 04:22:53 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

nickyboi

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?

Stramm

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

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?

Stramm

if you usr GD2  set in picmgmnt.inc.php
$yOffset to 0 (zero)

nickyboi


lostemilie

I set it like this now:
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?

lostemilie

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