[reportlab-users] Image from MySQL table and drawImage

dimitri pater dimitri.pater at gmail.com
Wed Sep 5 04:02:52 EDT 2007


Hello,

I use this code to insert an image (BLOB) from MySQL into a table:
from StringIO import StringIO
foto=StringIO(result[0][1])
foto.seek(0)
and the photo is inserted into the table, that works very well. I was
very glad when I managed to that :-), there are 100's of thumbnails in
the DB...
However, in another part of my applaication (where I create the first
page (the cover)) I am trying to do this:
fotogebouw=StringIO(result[0][2])
fotogebouw.seek(0)
c.drawImage(fotogebouw, 35*mm, PAGE_HEIGHT-220*mm, width=None,
height=None, mask=None)
results in an error:
c.drawImage(fotogebouw, 35*mm, PAGE_HEIGHT-220*mm, width=None,
height=None, mask=None)
File "C:\Python24\lib\site-packages\reportlab\pdfgen\canvas.py",
line 584, in drawImage
rawdata = image.getRGBData()
AttributeError: StringIO instance has no attribute 'getRGBData'

Any ideas or clues someone? The c.drawImage used to work with a image
stored on a local drive, but I need to have all data in the DB, also
the images.

Thanks, your help is appreciated!
Dimitri


--
---
You can't have everything. Where would you put it? -- Steven Wright
---
please visit www.serpia.org


More information about the reportlab-users mailing list