On Wed, Apr 9, 2008 at 1:49 PM, Steve Holden <<a href="mailto:steve@holdenweb.com">steve@holdenweb.com</a>> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">Victor Subervi wrote:<br>
> On Wed, Apr 9, 2008 at 12:51 PM, Steve Holden <<a href="mailto:steve@holdenweb.com">steve@holdenweb.com</a><br>
</div><div class="Ih2E3d">> <mailto:<a href="mailto:steve@holdenweb.com">steve@holdenweb.com</a>>> wrote:<br></div>I imagine the following code should do so, given your earlier writings:<br>
<div class="Ih2E3d"><br>
#! /usr/bin/python<br>
<br>
import MySQLdb<br>
<br>
print "Content-type: image/jpeg\r\n"<br>
host = 'host'<br>
db = 'bre'<br>
user = 'user'<br>
passwd = 'pass'<br>
</div><div class="Ih2E3d">connection = MySQLdb.connect(host=host, user=user, passwd=passwd, db=db)<br>
cursor = connection.cursor()<br>
cursor.execute('select img from photo where id="7";')<br>
</div>content = cursor.fetchall()[0][0]<br>
f = open("somefile.jpg", "w")<br>
f.write(content)<br>
f.close()<br>
<br>
Then see if you can deal with "somefile.jpg" like any other JPEG. If you<br>
can't then your blobs are somehow being mangled. If you can, we'll take<br>
it from there.</blockquote><div><br></div></div>Yes, I can. Shows up in browser when surfed to, and it was pulled from the database. No mangling. I am signing off, back tomorrow morning.<br>TIA,<br>Victor<br>