473,396 Members | 1,714 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

StringIO MySQL data blob Image problem

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:
lboq5\Y|A*,"m3Zf ""N,*It"b5@xq'ksd͏1 ؜
^J*C(r){:t_jo
C(c)[)gNXi 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)

--
---
You can't have everything. Where would you put it? -- Steven Wright
---
please visit www.serpia.org
Sep 5 '07 #1
0 2088

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Sugapablo | last post by:
Is there any PHP function that will allow me to determine the MIME type of a blob stored in MySQL? Specifically, if I'm storing an image as a blob in MySQL, is there any PHP function that can...
3
by: NotGiven | last post by:
I am researching the best place to put pictures. I have heard form both sides and I'd like to know why one is better than the other. Many thanks!
6
by: matt roberts | last post by:
Hello, I am parsing a mailbox using the imap functions, pulling out images attached and putting them into mySQL as BLOB fields. I am having problems displaying images once they are stored in...
10
by: John Smith | last post by:
I know that uploading an image to a database has been covered, oh, about 3 trillion times. However, I haven't found anything covering uploading to a MySQL database with .net. Please don't...
10
by: eholz1 | last post by:
Hello Members, I am setting up a photo website. I have decided to use PHP and MySQL. I can load jpeg files into the table (medium blob, or even longtext) and get the image(s) to display without...
3
by: Taras_96 | last post by:
Hi everyone, I'm having a bit of trouble understanding the purpose of escaping nulls, and the use of addcslashes. Firstly, the manual states that: "Strictly speaking, MySQL requires only...
0
by: dimitri pater | last post by:
---------- Forwarded message ---------- From: dimitri pater <dimitri.pater@gmail.com> Date: Sep 5, 2007 9:13 PM Subject: Re: StringIO MySQL data blob Image problem To: Tim Golden...
221
Atli
by: Atli | last post by:
You may be wondering why you would want to put your files into the database, rather than just onto the file-system. Well, most of the time, you wouldnt. In situations where your PHP application...
4
by: foss | last post by:
HI all, I am able to upload the image as blob to mysql. but while displaying the image i cant display it properly . The code used for uploading image to mysql inserts data into mysql table.The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.