Member
Member
ppy   2009-03-29, 05:49
#1

Hello,

I am using zenphoto 1.2.3[3427]

I have an image which is 1000 x 666 in size. I use getCustomImage function like this:
$image->getCustomImage(null, 900, null, 900,200, null, null).

This will give me a cropped 900x200 image. However, it's cropped from the original image, not the resized 900 width image.

So my question is: is there anyway I can change the order of cropping and scaling? I want it to scale first, then do the cropping based on the scaled image.

Is it possible?

Thanks

Member
Member
sbillard   2009-03-29, 23:23
#2

No, that is not possible. Make your crop based on the original image.

Member
Member
ppy   2009-03-30, 18:21
#3

Thank you very much sbillard.

I realized that after posting this question... All I need to do is to calculate the cropping width ,height and the x, y position.

Member
Member
ppy   2009-03-30, 19:08
#4

I found something strange though.

with my new function, i calculate the cropping width, height, x and y, then use getCustomImage() function. I set the output width to 900. What I found is if the picture size is large (width=3888) the output is perfect. However, if the original picture is just a little bit larger than 900, 1024 for example, the output picture is somehow flattened a little.

I have no idea why.

here's an example from zenphoto's demo gallery:

original picture (595x446): http://www.zenphoto.org/zenphoto/albums/demo-gallery/P4130946.jpg

flattened crop (width=523):
http://www.zenphoto.org/zenphoto/zp-core/i.php?a=demo-gallery&i=P4130946.jpg&w=523&cw=595&ch=132&cy=157

Even I chagne the output width and height to the same as the cropping size, the output is not right:
http://www.zenphoto.org/zenphoto/zp-core/i.php?a=demo-gallery&i=P4130946.jpg&w=595&h=132&cw=595&ch=132&cy=157

if i change the output width to a smaller size,say 400, the h/w ratio of the output is back to normal again:
http://www.zenphoto.org/zenphoto/zp-core/i.php?a=demo-gallery&i=P4130946.jpg&w=400&cw=595&ch=132&cy=157

Is this a bug in the cacheImage() function or in the php processing function?

Member
Member
sbillard   2009-03-30, 19:19
#5

You probably want to specify the size, not the width. If you need to specify the width you will probably need to compute both the width and the height values.

Member
Member
ppy   2009-03-30, 19:35
#6

Problem solved I guess.

I found this post: http://www.zenphoto.org/support/topic.php?id=5188

so if I add cx=1 to the examples above insdead of cx=0 or no cx, the output is fine.

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