zenphoto forums » Usage Support

Crop Photos Feature and Thumbnail scale

(5 posts)
  • Started 4 years ago by drewhack
  • Latest reply from acrylian
  1. drewhack

    Apprentice
    Joined: Dec '08
    Posts: 3

    I have seen several posts on this and I have unsuccessfuly gotten any of the "fixes" to work.

    Instead of having the thumbnails cropped to a square I would like them to maintain some sort of aspect ratio.

    I am using the Default Dark theme and have tried in several nightly builds (I am running 11-30 right now) as well as the stable 1.2.1. The previous fixes seem not to work still. What can I do to get that to happen. By that I am referring to thumbnails maintaining the aspect ratio of the image, without having to create individual thumbnails for each picture.

    Thx

    Posted 4 years ago #
  2. flu

    Contributor
    Joined: May '08
    Posts: 215

    Hi,
    I'd found something like this in this board.
    Did you try this code in your album.php theme for example ?

    <?php while (next_image(false, $firstPageImages)): ?>
    <a href="<?php echo htmlspecialchars(getImageLinkURL());?>" title="<?php echo getImageTitle();?> ">
    <?php
    $desirableThumbWidth = 150;
    $desirableThumbHeight = 150;
    if (isLandscape()) {
    $myImgSrc = getCustomImageURL(NULL,$desirableThumbWidth,NULL);
    }
    else {
    $myImgSrc = getCustomImageURL(NULL,NULL,$desirableThumbHeight);
    }
    ?><img src="<?=$myImgSrc?>" alt="<?php echo getImageTitle();?>"/></a>
    <?php endwhile; ?>

    Change the 150 value to the one you want.

    Posted 4 years ago #
  3. Zenphoto development team
    acrylian

    Developer
    Joined: Jul '07
    Posts: 13,502

    You should have found that we have the so called maxspace functions for that and after some issues with them they seem to correctly now in the nightly (they already are there in 1.2.1 but with bugs). For example they are mentioned here: //www.zenphoto.org/support/topic.php?id=4006#post-24199

    But here are the direct links to the documentation (where all available functions are listed):
    http://www.zenphoto.org/documentation/functions/_template-functions.php.html#functiongetCustomAlbumThumbMaxSpace
    http://www.zenphoto.org/documentation/functions/_template-functions.php.html#functiongetCustomSizedImageMaxSpace
    http://www.zenphoto.org/documentation/functions/_template-functions.php.html#functionprintCustomAlbumThumbMaxSpace
    http://www.zenphoto.org/documentation/functions/_template-functions.php.html#functionprintCustomSizedImageMaxSpace

    Don't forget to read the Forum rules and usage resources
    Posted 4 years ago #
  4. drewhack

    Apprentice
    Joined: Dec '08
    Posts: 3

    Sorry to be a noob, so how or what would I do with these functions to put them in properly so that whether the image is landscape or portrait that it just keeps the same maximum length on the longest side :(
    thx for the help

    Posted 4 years ago #
  5. Zenphoto development team
    acrylian

    Developer
    Joined: Jul '07
    Posts: 13,502

    You need to replace the standard image calls on the theme files with those functions. If you haven't already please read http://www.zenphoto.org/2008/05/theming-tutorial/ first to get a little familiar with Zenphoto themes in general. Also please consider to read http://www.zenphoto.org/2008/04/how-to-read-the-zenphoto-functions-guide/ too. Of course changing a theme requires some basic knowledge of HTML, CSS and PHP.

    Don't forget to read the Forum rules and usage resources
    Posted 4 years ago #

RSS feed for this topic

Reply

You must log in to post.