Image Script
As part of the project I was talking about in the last post, I've now got an early draft of my image script. It's working quite nicely, if I do say so myself...
You tell it the path to the file, specify width and/or height and a number (integer, 0-3 preferably) of quarter-turns clockwise. If you don't specify any dimensions it gives you the image's native size, if you specify only one it fixes that and uses the aspect ratio to determine the other, and if you give both it ignores the ratio to fix both.
The next step is to teach it to cache images, since the rotate operation is very processor intensive and the [relatively] static posts around here should be asking for the same versions of the images time after time.
I'm pretty pleased with it. If anyone wants to see the source or anything, give me a shout.
Update: Sorted the caching: if a suitable file exists it grabs and regurgitates that, and if not it does the processing as before and saves it for next time. Also it now accepts a fourth parameter as a maximum value in the larger dimension, and I'm using that rather than the literal height/width.
Now to get back to testing the mail part (which I don't really trust).
You tell it the path to the file, specify width and/or height and a number (integer, 0-3 preferably) of quarter-turns clockwise. If you don't specify any dimensions it gives you the image's native size, if you specify only one it fixes that and uses the aspect ratio to determine the other, and if you give both it ignores the ratio to fix both.
The next step is to teach it to cache images, since the rotate operation is very processor intensive and the [relatively] static posts around here should be asking for the same versions of the images time after time.
I'm pretty pleased with it. If anyone wants to see the source or anything, give me a shout.
Update: Sorted the caching: if a suitable file exists it grabs and regurgitates that, and if not it does the processing as before and saves it for next time. Also it now accepts a fourth parameter as a maximum value in the larger dimension, and I'm using that rather than the literal height/width.
Now to get back to testing the mail part (which I don't really trust).
Comments