I did that. In fact, just to make things easier, I wrote out exactly what is supposed to be rendered, as below:<br><br>#!/usr/local/bin/python<br>import cgitb; cgitb.enable()<br>import MySQLdb<br>import cgi<br>import sys,os<br>
sys.path.append(os.getcwd())<br>from login import login<br>user, passwd, db, host = login()<br>form = cgi.FieldStorage()<br>db = MySQLdb.connect(host, user, passwd, db)<br>cursor= db.cursor()<br>sql = "select pic1 from products where id='1';"<br>
cursor.execute(sql)<br>content = cursor.fetchall()[0][0].tostring()<br>cursor.close()<br>print '''Content-Type: image/jpeg<br><br>Content-Encoding: base64<br>'''<br>print<br>print content.encode('base64')<br>
<br>I even changed the "image/jpeg" to "text/html" to see if the image would print out the binary, and it did, so I'm calling the image correctly, just not rendering the binary as an image.<br>V<br>
<br><br><div class="gmail_quote">On Wed, Oct 7, 2009 at 2:47 PM, Gabriel Genellina <span dir="ltr"><<a href="mailto:gagsl-py2@yahoo.com.ar">gagsl-py2@yahoo.com.ar</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
En Wed, 07 Oct 2009 12:00:13 -0300, Victor Subervi<br>
<<a href="mailto:victorsubervi@gmail.com">victorsubervi@gmail.com</a>> escribió:<br>
<div class="im"><br>
> print '''Content-Type: image/jpeg<br>
><br>
</div>> '''<br>
> print<br>
> print content<br>
<br>
On Wed, Oct 7, 2009 at 9:51 AM, Gabriel Genellina <gagsl-<br>
<a href="mailto:py2@yahoo.com.ar">py2@yahoo.com.ar</a>>wrote:<br>
<br>
> That's still wrong. The output should be:<br>
><br>
> - a line containing Content-Type: image/jpeg<br>
> - a blank line (no more!)<br>
         ^^^^^^^^^^^^^^^^^^^^^^^^^<br>
> - the actual image data<br>
<br>
--<br>
Gabriel Genellina<br>
<font color="#888888">--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></blockquote></div><br>