Is there a way to change the crop position for thumbnails from centered? I would like my thumbnails that come from the larger pictures cropped so that its:
vertical - top
horizontal center
is there anyway to acheive this? I tried searching for an answer to no avail
Comments
Go down to line 205 which should be:
`if ($cy === false) $cy = round(($newh - $ch) / 2);`
Comment that line out by placing // before it so your end result should look like this:
`//if ($cy === false) $cy = round(($newh - $ch) / 2);`
Then just save it, clear your cache, and then reload the page.
I tried to do as you described but in the i.php file that i have, there is only 101 lines and no code like you described above.
Im using the zen photo files frm the version available from the front page 1.0.3
is there a way to do it with this version?
that you can "Image sizing/cropping any way you want (for theme developers and/or users and/or plugin authors)" within v1.03
I looked at the stopdesign theme and saw this:
<?php printCustomAlbumThumbImage(getAlbumTitle(), null, 200, null, 210, 210); ?>
could anyone explain the variables used? I know the 210's are for height and width, but what about the 200 and nulls? I couldn't find any documentation concerning this...
basically what I want to achieve is thumbnails that are what ever height and width, but are cropped from the top downwards and not centered cropped?!
printCustomAlbumThumbImage($alt, $size, $width=NULL, $height=NULL, $cropw=NULL, $croph=NULL, $cropx=NULL, $cropy=null, $class=NULL, $id=NULL)
My problem is I want a set width and height cropped thumbnail but, when i set it most of the time faces are cut out of thumbs and you only see bodies. So i need to change the crop position so that its not so centered and more towards the top of each thumb/picture??!
printCustomAlbumThumbImage('', 100, NULL, NULL, 80, 80, -1, 0, NULL, NULL)
will get you a 100-width image, cropped to 80x80, from the x-center/y-top (-1 means center-x, 0 means top-y).
So that's all done in the theme with that function. Let me know if you need any more help.
cheers
<?php printCustomThumbImage(getImageTitle(), null, 85, null, 85, 85, -1, 0, null, null); ?>
however when I try to view an album page I get an error message for the line that the custom cropped/sized thumbnail code is on, though im not getting any errors whilst using this (ie this custom sized/crpped code works):
<?php printCustomAlbumThumbImage(getAlbumTitle(), null, 230, null, 210, 100, null, 30, 'reflect', null); ?>
on my index page that shows the individual albums??!!
Nope, it wasn't. Here's the right one:
`printCustomSizedImage($alt, $size, $width, $height, $cropw, $croph, $cropx, $cropy, $class, $id)`
We really need some good documentation on those template functions... I'll work on getting someone to do that.
The previous and next image thumbnails on the image.php page are done differently then the other images in that there isn't a php code to call in the image rather the img source with the php for the next image thumbnail url. eg:
<img src="<?=getPrevImageThumb(); ?>" />
is there a way to apply a custom crop to this?
or is there a way to hack zenphoto, so that instead of center/center (x/y axis) crop for general thumbs its center/top?? That would make things abit simpler
Im guessing its this section that says:
// If s=thumb, Set up for the default thumbnail settings.
$size = $_GET['s'];
if ($size == "thumb") {
$thumb = true;
if ($thumb_crop) {
if ($thumb_crop_width > $thumb_size) $thumb_crop_width = $thumb_size;
if ($thumb_crop_height > $thumb_size) $thumb_crop_height = $thumb_size;
$cw = $thumb_crop_width;
$ch = $thumb_crop_height;
$crop = true;
} else {
$crop = $cw = $ch = false;
}
$size = round($thumb_size);
$quality = round($thumb_quality);
// Otherwise, populate the parameters from the URI
} else {
if ($size == "default") {
$size = $image_default_size;
} else if (empty($size) || !is_numeric($size)) {
$size = false; // 0 isn't a valid size anyway, so this is OK.
} else {
$size = round($size);
}
if (isset($_GET['w'])) { $width = round($_GET['w']); }
if (isset($_GET['h'])) { $height = round($_GET['h']); }
if (isset($_GET['cw'])) { $cw = round($_GET['cw']); $crop = true; }
if (isset($_GET['ch'])) { $ch = round($_GET['ch']); $crop = true; }
if (isset($_GET['cx'])) { $cx = round($_GET['cx']); }
if (isset($_GET['cy'])) { $cy = round($_GET['cy']); }
if (isset($_GET['q'])) { $quality = round($_GET['q']); }
}
$postfix_string = ($size ? "_$size" : "") . ($width ? "_w$width" : "")
. ($height ? "_h$height" : "") . ($cw ? "_cw$cw" : "") . ($ch ? "_ch$ch" : "")
. (is_numeric($cx) ? "_cx$cx" : "") . (is_numeric($cy) ? "_cy$cy" : "");
} else {
// No image parameters specified; return the original image.
header("Location: " . PROTOCOL . "://" . $_SERVER['HTTP_HOST'] . WEBPATH
. "/albums/" . rawurlencode($album) . "/" . rawurlencode($image));
return;
}
though im not sure what to alter to make it customed cropped??
Any suggestions? Is there another function somewhere that would be used for bulk uploads? I'll keep looking...
There's got to be a function somewhere that's creating those thumbnails. But where??
The code should be dependent on how the images were uploaded. What is it that you are seeing that is different in the two cases?
I gave up on trying to fix that and just used the generate custom thumb functions instead.