[Zope] Re: Resizing Images In Page Templates

Josef Meile jmeile at hotmail.com
Mon Mar 5 03:48:33 EST 2007


Hi tony

> I saw somewhere someone adding code like this:
> <img src="myimage.jpg/resize" />
> that would automatically resize his image according to a predetermined 
> standard. Does anyone know how this or something similar is done?
Yes, I have seen this. Silva, a zope based CMS, has a class called 
SivaImage. Inside that object, you can specify a scale. Then inside 
another class called SilvaDocument, it will be called as follows:

<img src="myId.jpg/hires_image"> -> Will get the image with its real 
resolution

<img src="myId.jpg/image"> -> Will get a resized version of the image

I know that class uses PIL. You could download it from:
http://www.infrae.org/

and take a look at it.

The only thing I don't like is that when saving an image, its name will 
be either "hires_image.jpg" or "image.jpg" instead of the real name.

Regards
Josef


More information about the Zope mailing list