[Grok-dev] image files in a folder
janwijbrand at gmail.com
Sat Jul 17 11:43:24 EDT 2010
On 7/13/10 17:54 PM, Uwe Hentzschel wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> i have many image files in a folder like '/Users/uhe/images'. I have to
> manipulate the files with PIL. How can a pagetemplate show images from
> a folder (not the "static" folder.). It is not nessery to save the
> manipulated images.
One way to do it would be something like this:
# This will return an file object as the response content.
# Zope knows how to deal with returning file contents.
In you pagetemplate you can then do something like:
<img src="" tal:attributes="python: view.url('someimage')" />
But you might be better of by registering a DirectoryResource for the
directory holding your images.
More information about the Grok-dev