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?