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
Comments
I realized that after posting this question... All I need to do is to calculate the cropping width ,height and the x, y position.
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?
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.