D
dimitri pater
Hi,
I am trying to insert an image, which is stored as a blob in MySQL,
into a table using Reportlab.
I have tried this:
from StringIO import StringIO
cfoto = StringIO(result[0][1]) # where result[0][1] is the 'blob'
cfoto.seek(0)
foto=cfoto.getvalue
But when I do:
print foto, I see something similar to this:
array('c','\xff\xd8\............etc.......etc......')
This is also the string I see in the table, in stead of the actual image.
I have tried:
cfoto StringIO()
cfoto.write(result[0][1].tostring())
foto=cfoto.getvalue()
that returns:
ÿØÿàúlbo¤qÁ5¼–Ò\¸•£ˆˆ‡Y|Aø—,ñé–ú…"ìâm3Z¸ŒÁfêñ""NÔ,¡¾ÚÀIæÃt"Äb5Î@xqô'ÍkÕÁå¼sàßd˜ª²«ÍÉ1ØœÏ
‡^ÖJ*™C(r)ë{:tâ¥_‡Çâ–´°joÙÃ
¿C(c)¯äÜ[)¯gN«ÃæXßi etc... etc...
and return an UnicodeDecodeError when I try to insert this into the table
Any ideas or clues someone? Your help is appreciated.
Dimitri
(BTW, the MySQL image blob is valid, it shows up in MySQL Query Browser)
I am trying to insert an image, which is stored as a blob in MySQL,
into a table using Reportlab.
I have tried this:
from StringIO import StringIO
cfoto = StringIO(result[0][1]) # where result[0][1] is the 'blob'
cfoto.seek(0)
foto=cfoto.getvalue
But when I do:
print foto, I see something similar to this:
array('c','\xff\xd8\............etc.......etc......')
This is also the string I see in the table, in stead of the actual image.
I have tried:
cfoto StringIO()
cfoto.write(result[0][1].tostring())
foto=cfoto.getvalue()
that returns:
ÿØÿàúlbo¤qÁ5¼–Ò\¸•£ˆˆ‡Y|Aø—,ñé–ú…"ìâm3Z¸ŒÁfêñ""NÔ,¡¾ÚÀIæÃt"Äb5Î@xqô'ÍkÕÁå¼sàßd˜ª²«ÍÉ1ØœÏ
‡^ÖJ*™C(r)ë{:tâ¥_‡Çâ–´°joÙÃ
¿C(c)¯äÜ[)¯gN«ÃæXßi etc... etc...
and return an UnicodeDecodeError when I try to insert this into the table
Any ideas or clues someone? Your help is appreciated.
Dimitri
(BTW, the MySQL image blob is valid, it shows up in MySQL Query Browser)