[Zope] PIL and Filesystem

Phillip Crumpler phillip@crumpler.com.au
Tue, 13 Mar 2001 23:56:48 +1100


You can make a pretend file-like object with the python module StringIO.
Look in the Photo product for an example of this or try a snippet I did this
morning:

        from cStringIO import StringIO

        # construct and upload a thumbnail
        fd.seek(0)
        im = PIL.Image.open(fd)
        im.thumbnail(thumb_size)
        outFile = StringIO()
        im.save(outFile, thumb_format, quality=thumb_quality)
        outFile.seek(0)
        self.thumb.manage_upload(outFile)
        self.thumb.manage_changeProperties(title=self.title or self.id)

cheers,

.flip.


> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
> brocken22@gmx.de
> Sent: Tuesday, 13 March 2001 10:44 PM
> To: zope@zope.org
> Subject: [Zope] PIL and Filesystem
>
>
> Hello,
> I'm using PIL to convert bmp and tiff-images to jpeg.
> After conversion they should be added to Zope.
> My problem is that for conversion, I think, I have to
> safe them on the filesystem.
> Zope's security policy doesn't allow me to delete
> files with an external method.
> Am I forced to do a cron-job?
> Isn't it possible to change the format in another way??
> Thanks very much!!
> I've heard that's easier to stream the images and convert them on the fly!
> Any hint??
>  Thanks.
>
> --
> Sent through GMX FreeMail - http://www.gmx.net
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>