ZenphotoCMS Forum
$size - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: $size (/thread-3840.html)



$size - ela002 - 2008-10-02

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




$size - acrylian - 2008-10-02

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).




$size - ela002 - 2008-10-06

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




$size - acrylian - 2008-10-07

Please try tonight's nightly. There was a bug in the maxspace functions.




$size - ela002 - 2008-10-07

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




$size - ela002 - 2008-10-07

I have updated to latest source code I still got problems.




$size - acrylian - 2008-10-08

The "array" problem or what?




$size - amucklow - 2008-11-16

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.

?




$size - acrylian - 2008-11-16

Try these:
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

If you want to use the albumthumb variant you need to use the nightly/svn since the 1.2.1 ones contains some bugs.




$size - amucklow - 2008-11-17

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:

`




$size - sbillard - 2008-11-17

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.




$size - amucklow - 2008-11-18

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.




$size - sbillard - 2008-11-18

There appears to be an error in getCustomSizedImageMaxSpace() check tonight's build for a fix.




$size - amucklow - 2008-11-19

OK thanks. I assume I just need to download template-functions.php from the trunk...




$size - acrylian - 2008-11-19

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.