[reportlab-users] Using images in body of rlzope.py example

Jerome Alet alet at librelogiciel.com
Wed Mar 28 13:23:34 EDT 2007


On Wed, Mar 28, 2007 at 01:19:00PM -0400, Dev Sen wrote:

> I guess a more general question related to this would be how to replace

> "self.getImageFromZODB("logo") with the appropriate path to grab an image

> stored on the filesystem dependent on some parameter. For example,

> "/path/images/image=RelevantParameterHere". Is that doable?


Just replace the getattr call with an urllib2.urlopen() call,
with an URL of type file://localhost/path/to/your/image then
the advantage is that by using urlopen all URL types recognized
by Python's standard library are supported.

Your could even use something like (just an example) :

urllib2.urlopen("http://localhost:9673/path/to/your/image?size=big")

to access to the very same image but "externally" instead of from
local ZODB calls (supposing you're using Zope under Debian, where
the default port is set to 9673).

the rest of the code might need some more work, but you get the
idea.

hth

Jerome Alet


More information about the reportlab-users mailing list