Member
Member
pju_photo   2010-04-19, 17:14
#1

Hello,

first of all I want to thank everyone involved with it for ZenPhoto - I'm really liking it.

Yet to be brutally honest that's not why I registered to this forum. Rather, the reason for that was the following problem:

I'm coding my second custom theme now and would like to know whether there is an easy way to find out the width of images gained via getCustomSizedImageMaxSpace().
I figured that getSizeCustomImage might be the way to go, but it seems that I can only get it to scale the pics to either the width or height I specify - not into the maxspace. Let's say if the max size was 600x400 it would give back only values with 600px width, and ignore the 400px height - resulting in height values bigger than 400.

At first I thought I could work around this by passing a width to getSizeCustomImage for landspace formats and a height for portrait formats. But of course this doesn't work for narrow landscape shots - like say a 5x4 format.

I tried passing both the original size (via getSizeCustomImage), 0 and empty $size values to getSizeCustomImage with my desired max width / height as the second and third parameter but to no avail.

Am I missing out on something in here or is there just no way to do this with the template functions? I guess I could figure some workaround out by myself, but if there is an easy way to do this it would be great.

Thanks a lot,
Philip

Administrator
Administrator
acrylian   2010-04-19, 17:23
#2

The maxspace set of image functions is meant to be used to scale images to fit in the width x height size defined. So what you describe is what they are meant for. But in case your images do not store the right values internally it might go wrong.

A link to the image in question would help.

Member
Member
pju_photo   2010-04-19, 18:31
#3

Wow, thanks for the fast reply.
I might have worded this a bit complicated though. Actually the maxspace function works just fine, that's not my problem.

What I want to do is get the width of the resulting picture so I'll be able to use it as the width for the div container I'm putting it in.

What the problem is: let's say I have an image with a size of 616 px * 500 px.
I want to scale it to a max of 610 px * 450 px.
This results in a picture of 554 px * 450 px.

I thought I could fetch the width with getSizeCustomImage, but all I can get it to return is Array ( [0] => 610 [1] => 495 ). So I wondered whether there is a way to use getSizeCustomImage to do this so I could get [0] => 554 [1] => 450.

The image I used as a test image is actually online here: http://www.spiegel.de/img/0,1020,635396,00.jpg

Thanks,
Philip

Member
Member
sbillard   2010-04-19, 19:49
#4

Maybe the function getMaxSpaceContainer() will give you what you wish.

Member
Member
pju_photo   2010-04-19, 20:37
#5

Indeed it did. Thanks a lot, must have been blind not to see this.

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.