I would like to make my thumbnails stay in their correct proportions, and always have the longest side resizes to 125px.
So if an image was 500x750 the thumbnail would be be 84x125.
If an image is is 750x500 the thumbnail will be 125x84.
Could someone help me!
Thanks!
Cooper
PS. I searched and browsed, and I feel like this has been discussed before, but I couldn't find a clear and concise description.
Comments
Some themes (eg: stopdesign) may override this if they have special design requirements, so those would require going into the theme code (and probably the HTML/CSS design) to change.
...should the 'zen' folder also be 777'd?
I'm just starting in on doing another new gallery display, so I'm just checking out the new 1.1 release. Great work!
As for thumbnails, I ran into this issue myself, and thought I'd share my solution.
In a nutshell, if I've got "Images size is longest size" checked yes, and "Crop thumbnails" unchecked in the admin / options / image display settings, I would expect to have the images uncropped, and scaled to fit within the thumb size. To do this, you just need a little change to i.php
Add this line to the "Set the config variables for convenience" section at the top:
`
$thumb_crop = getOption('thumb_crop');
`
Then find this line:
`
if ((!$thumb && $size && $image_use_longest_side && $h > $w) || ($thumb && $h <= $w) || $height) {<br />
`
and change it to:
`
if ($thumb && !$thumb_crop && $image_use_longest_side ) {
if( ($cw/$ch) > ($w/$h) ){
$newh = $ch;
$neww = $w*($ch/$h);
}else{
$neww = $cw;
$newh = $h*($cw/$w);
}
$crop=0;
} else if ((!$thumb && $size && $image_use_longest_side && $h > $w) || ($thumb && $h <= $w) || $height) {<br />
`
Of course, not every theme is going to work with that, but if you want the ability to get the intuitive (at least, that's the way I think it should work with those settings), then this should do the trick.
I´ve been trying to do something (in theory simple) with thumbnails but with no luck:
1) Fixed size in both dimensions so gallery looks like a regular grid
2) No cropping
This means images have to be scaled and padded to fit thumb size. I´ve checked several threads but none of the proposed solutions seems to work with ZenPhoto 1.1.5 (note i.php has changed completely so above hack no longer applies).
Please help. BTW, shouldn't this be the default behavior if crop is disabled and thumb sizes are specified?
Thanks in advance,
Fede
Or you try modifiying album.php with this function: http://www.zenphoto.org/documentation/Zenphoto/_template-functions.php.html#functionprintCustomSizedImageMaxHeight
But since that relies on the sized images size and not the thumbnail size, you probably should use this or the printCustomSizedfunction on image.php, too.
Anyway, I guess I should modify the printCustomSizedImageMaxHeight with an option for the width...
I've been already playing with the getCustom* functions but as far as I could see they do not add any padding on the images, so you either get the size you want in one dimension or you get a deformed image (obviously). So probably the best thing to do would be to workaround this on the CSS. I have little experience with CSS, do you know of any example around doing something similar? Thanks,
--f
@fardanz: Of course that function does not add padding to the images. That is the job of CSS. Please understand that we can't teach the basics of CSS here, since this is not a specific zenphoto issue. Please refer one of the many resources on the web.
I found such resolution, no need zenphoto core hack:
`<?php<br />
if (isLandscape()) {
$myImgSrc = getCustomImageURL(NULL,166,NULL);
}
else {
$myImgSrc = getCustomImageURL(NULL,NULL,166);
}
?>
" />`
or with next_image() loop:
`<?php while (next_image(false, $firstPageImages)): ?>
" title="<?php echo getImageTitle();?>">
<?php <br />
if (isLandscape()) {
$myImgSrc = getCustomImageURL(NULL,166,NULL);
}
else {
$myImgSrc = getCustomImageURL(NULL,NULL,166);
}
?>
" />
<?php endwhile; ?>`
`<?php <br />
$desirableThumbWidth = 150;
$desirableThumbHeight = 100;
if (isLandscape()) {
$myImgSrc = getCustomImageURL(NULL,$desirableThumbWidth,NULL);
}
else {
$myImgSrc = getCustomImageURL(NULL,NULL,$desirableThumbHeight);
}
?>
" />`
thumbsize parameter can be cropped or uncropped up to 800px size. But
400c size is not allowed (biggest allowed cropped size is 160c).
For example, request http://picasaweb.google.com/data/feed/api/user/greeceru/album/test?th...
says "thumbsize: That is not one of the acceptable values".
Did I something wrong? Thanks.
`getCustomAlbumThumbMaxSpace()` and `printCustomAlbumThumbMaxSpace()` (only for album thumbs) as well as
`getCustomSizedImageMaxSpace()` and `printCustomSizedImageMaxSpace()` (for both the thumbas within an album and the sized image).
See template-function.php directly for parameters
How would I implement those functions? And where?
I'm on version 1.2.8 [4881]
My client's site is for fine art and nature photography. He doesn't like that his photos are getting cropped.. and not showing the full proportion. If I turn cropping off it's a mess because he has horizontal and vertical photos all over the place.