[nycphp-talk] Resample Image on the Fly
Urb LeJeune
urb at e-government.com
Mon Jan 29 10:58:44 EST 2007
>What I have done is used getimagesize(0 to get the original width and
>height of the image. Then I modify those values proportionally with a
>script I wrote and do this:
>
><img src="'.$url.'" width="'.$newW.'" height="'.$newH.'" />
There is a downside to this technique. If you are display the image
smaller than the original the full sized image is downloaded. If you are
displaying it larger than the original the quality is reduced.
Take a look at an application I'm currently developing. It is a
magizine/newsletter publishing system. It's not quite ready for prime
time but you're get the idea of what I'm doing.
http://ncvoa.e-government.com/magazine/index.php
notice the different sized images even though there is only one saved image.
The administrator can set the maximum image size for:
Uploaded images, issue, cover article, feature article,
author, and album.
If an uploaded image is larger than the maximum size it
reduced to that
size before saving. Only one image is saved.
If an image is to be used for a cover article (150 pixels
max) it is first
resized on the server and display at that size without being saved to disk.
Is that what you had in mind?
Urb
More information about the talk
mailing list