Bruno Miguel Silva wrote:
Hi, I have a small script that generate a image with some text, in python with Python Imagin Library (PIL). The problem is, i want a security image in an html page in zope, so i started to put the code in a External module, and now i have all kind of problems with that script.
for opening an image with PIL in an ExternalMethod (assuming that the image to load is in the ZODB), i use: from PIL.Image import * from cStringIO import StringIO def processImage(): img_to_open = ImageFolder.restrictedTraverse(ImageID) img = open(StringIO(str(img_to_open._data))) [... img processing stuff come here ...] final_img = StringIO() img.save(final_img, final_img.format) final_img.seek(0) return finalmap.getvalue() HTH
When i use the "ImageFont.load('pathToFont.pil')", that causes an Error Type: IOError Error Value: cannot find glyph data file i don' understand, because i have the ".pbm", and it works in command line.
is it '.pbm' ? I oftenly use '.bmp'
So, then i try to do "ImageFont.load_path('font.pil')", and that causes a Error Type: IOError Error Value: cannot find font file once again i couldn't understand because it works on command line, because the font file is in "/usr/lib/python2.3/site-packages/pilfonts/"
Sorry, I never worked with fonts
At this time, i start to dig in the sourcecode of ImageFont.py, and i found that when it raises the "cannot find glyph data file", is when it try's to open the ".pbm" file with Image.open(), i tried to do this to get more information, and it gives a Error Type: AttributeError Error Value: 'file' object has no attribute 'startswith'
I don't know if this makes any sense to you, .... but are there someone to help me in this? Do i have other alternatives to generate images with text on the fly in zope?
thanks in advance, --Bruno Silva _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
.
-- David Convent