html resize pics

Peter Hansen peter at engcorp.com
Wed Dec 28 10:21:58 EST 2005


rbt wrote:
> I use Python to generate html pages. I link to several 
> large images at times. I'd like to display a thumbnail image that when 
> clicked will go to the original, large jpg for a more detailed view.

I use PIL with the thumbnail() function for that...  depending on what 
sort of web server/framework you are using, you could generate the 
thumbnails dynamically, or you could pre-generate them and store both 
files (this is probably the most common way to do it).  The HTML, of 
course, has to be generated to refer to the appropriate file: the IMG 
source is the thumbnail, the anchor's href points to the larger image.

-Peter




More information about the Python-list mailing list