[Zope] size of image in LocalFS

maxm maxm@mxm.dk
Wed, 23 Oct 2002 08:12:43 +0200


AM wrote:
> Hi,
> I have a set of images in a LocalFS. I provide links to those images on 
> another page and when a user clicks on those links a small window pops 
> up that displays the image.
> Is it possible in anyway to figure out the size of the image in advance 
> so that I can size the pop up window to be the same??

untested:

from OFS.Image import getImageInfo

# you can probably get the data in another way via localFS
f = open('path/to/image.jpg')
data = f.read()
f.close()

content_type, width, height = getImageInfo(data)

regards Max M