Find Original Height And Width Of Album Thumbnail

I need to find the original height/width of the thumbnail image for the current album so that I can work out the images aspect ratio.

I've tried getDefaultHeight/getDefaultWidth but I can't get them to return a value.

I'm guessing I need to pass an image into these functions as no image is selected by default (like they were in my next_image loop) but I can't figure out how to get it working.

Any help would be appreciated.

Comments

  • fretzl Administrator, Developer
    Something like this ?

    `
    <?php
    $originalWidth = $_zp_current_album->getAlbumThumbImage()->getWidth();
    $originalHeight = $_zp_current_album->getAlbumThumbImage()->getHeight();
    ...
    do something
    ...
    ?>
    `
  • acrylian Administrator, Developer
    @Epsilon: All on Zenphoto works with the object model framework as the base. Lots of plain template function do directly work if you are in the right context (album, image etc). Outside you most always need to pass an object of the image or album to get a result. `http://www.zenphoto.org/news/zenphotos-object-model-framework

    Info on all functions you find here: http://www.zenphoto.org/documentation/elementindex.html
    (use the browser page search to find something). Note the difference between normal functions and class methods ;-)

    You can also get the size of the full image by using `getSizeFullImage($image)` where `$image` must be an image object unless you are on the single image.php page.

    There is also `isLandscape($image)` to find the orientation of the (uncropped) image.
  • Exactly what I was looking for, thanks :)
Sign In or Register to comment.