$size

getCustomImageURL [line 2150]

Returns the url to the image in that dimensions you define with this function.
Parameters:
int $size: the size of the image to have
int $width: width
int $height: height
int $cropw: cropwidth
int $croph: crop height
int $cropx: crop part x axis
int $cropy: crop part y axis
bool $thumbStandin: set true to inhibit watermarking

Can somebody explain to me what $size means? You can set width and height and that one is confusing me. Thanks

Comments

  • acrylian Administrator, Developer
    If you set the size to 500 for example zenphoto will use it for the longest side of your picture. So a landscape image will be 500px wide and a portrait one 500 px high. Best you try a little around with that.

    If you want to set a max width and an max height so that no image get bigger than lets say 800 x 600 then you could use the new 1.2.1 maxspace functions (search for that on our functions guide).
  • I tried maxspace but it doesn't return url to the photo it's loading as a thumbnail to the existing web page.

    Anyone that can help please, I am trying to get a resized photo at specific resolution, not cropped one.

    Thanks
  • acrylian Administrator, Developer
    Please try tonight's nightly. There was a bug in the maxspace functions.
  • It returns a string "Array" not a url like getCustomImageURL but I think you mean to try zenphoto-2008-10-07-trunk which is not out yet ;)
  • I have updated to latest source code I still got problems.
  • acrylian Administrator, Developer
    The "array" problem or what?
  • I'm also looking for a function that returns an image URL specifying a maximum width and a maximum height. The layout I'm working on has a container of fixed dimensions, and I don't want to crop the images. `getCustomImageURL()` would work with its `$size` parameter, but I actually want the `$width` to be no more than 675px, and the `$height` to not exceed 550px.

    ?
  • Thanks. It's the custom sized image variants I'm interested in, because the thumbs will stay the same size.

    I'm using a galleria / zenphoto theme with the action taking place on `album.php`. Here's my code for the loop:

    `
    <?php while (next_image(false, $firstPageImages)): ?>
    >" title="<?php echo getImageTitle();?>"><?php printImageThumb(getImageDesc(),getImageTitle()); ?>
    <?php endwhile; ?>
    `
    Replacing `getCustomImageURL(500)` with `getCustomSizedImageMaxSpace($width=675, $height=550)` is what I understand should work, but it isn't - neither the custom sized images nor the thumbs load. Am I doing something wrong?

    I guess one solution is to size each image exactly and use `getFullImageURL()`.
  • You need to get some understanding of PHP syntax. Specifically how function parameters work. In PHP (and most procedural languages) function parameters are positional. That means that, in the case of `getCustomImageURL()`, the first parameter is the size value, the second is the width, the third is the height, etc.

    So, the call you want is `getCustomImageURL(NULL, 675, 550)`. You could also do a search on `getCustomImageURL` and see how other themes are using it.
  • Thanks - that's very useful. However `getCustomImageURL(NULL, 675, 550)` returns a sized image cropped to the given dimensions. What I need is an image that is uncropped but is sized within a maximum width of 675, max height 550 - whichever the image exceeds first. I would expect `getCustomSizedImageMaxSpace(675, 550)` to work, but it doesn't.
  • There appears to be an error in `getCustomSizedImageMaxSpace()` check tonight's build for a fix.
  • OK thanks. I assume I just need to download template-functions.php from the trunk...
  • acrylian Administrator, Developer
    Once again: It is strongly recommended never to install single files from the trunk/svn but to do a complete install. Zenphoto files depend on each other.
Sign In or Register to comment.