StringIO MySQL data blob Image problem

D

dimitri pater

---------- Forwarded message ----------
From: dimitri pater <[email protected]>
Date: Sep 5, 2007 9:13 PM
Subject: Re: StringIO MySQL data blob Image problem
Well, I'm mystified. Not by your results: that exactly what I
expected to get, but because you're doing everything *except*
manipulating an image and putting it into a PDF via ReportLab.
Dear Tim,
you are right of course, I have been trying to put the StringIO in a temp file:
cfoto=StringIO
cfoto.write(result[0][1].tostring())
dfoto=cfoto.getvalue()
fileFoto=open('temp.jpg','wb')
fileFoto.write(dfoto)

and indeed, the blob from MySQL is saved as an image!
however,
foto= Image('temp.jpg')
and inserting foto into a table results in:
x = struct.unpack('B', image.read(1))
error: unpack str size does not match format
oh, well... still needs some work
BTW: I used 'local' images before (I mean they did not originate from
a DB), that worked well in Reportlab's tables.
Thanks, I am getting there (I think)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,744
Messages
2,569,479
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top