[reportlab-users] Image from MySQL table and drawImage

dimitri pater dimitri.pater at gmail.com
Wed Sep 5 04:16:33 EDT 2007


Sorry, I really should apologize...
inserting the image into the table doesn't work either. The text:
<StringIO.StringIO instance at 0x01443EB8>
is inserted into the table, not the image. I have no clue how to fix this...

I thought it worked, but I had some 'old' code still uncommented, that
did the job
stupid of me, sorry about that

On 9/5/07, dimitri pater <dimitri.pater at gmail.com> wrote:

> 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

>



--
---
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