Sizing Up Graphics Automatically
Kevin Cazabon
kevin at cazabon.com
Fri Nov 16 16:59:43 EST 2001
Actually, it's very easy using Python and PIL (Python Imaging Library,
see www.pythonware.com), I do a very similar thing on my website,
sizing graphics to the resolution of the user's browser before sending
them (to save bandwidth).
I use JavaScript on the client side to send me the screen resolution
(to a Python cgi script), and process the image from there.
See: www.cazabon.com/wedding
for the example. If you are interested, I'll gladly provide the
source code I use. (it's actually a very nicely automated photo album
script, combo Perl/Python. All I do is create a folder, drop images
in (any size), and the script does the rest... they're online
immediately, in a category named by the folder I created.)
Kevin Cazabon.
Ben Ocean <zope at thewebsons.com> wrote in message news:<mailman.1005924983.29807.python-list at python.org>...
> Hi;
> Is it possible to automatically size up a graphic upon upload and
> programmatic insertion into a script? I use Zope and want to build a
> through-the-Web interface to enable my client to automatically change/add
> photos, but I want to set the site up such that all the dimensions of
> graphics, font sizes, etc., are resized depending on the visitor's browser
> resolution. In order to do that, I *must* somehow capture the dimensions of
> the uploaded graphic programmatically? Any ideas how to do this? Anybody
> have some code they'd like to share?
> TIA,
> BenO
More information about the Python-list
mailing list