Yes it is. I have had it print to screen already, and there is data in the database.<br>V<br><br><div class="gmail_quote">On Wed, Oct 7, 2009 at 10:03 AM, Rami Chowdhury <span dir="ltr"><<a href="mailto:rami.chowdhury@gmail.com">rami.chowdhury@gmail.com</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;"><div class="im">On Wed, 07 Oct 2009 06:37:08 -0700, Victor Subervi <<a href="mailto:victorsubervi@gmail.com" target="_blank">victorsubervi@gmail.com</a>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I took out the line in question (with text/html). Now it prints to screen<br>
the url. It did that before. Strange. Any other ideas?<br>
TIA,<br>
V<br>
</blockquote>
<br></div>
Looking at the output, it seems the reason for this (for me) is that Firefox can't find the image or any alt text for it, so it's just using the image URL. Are you certain the image data (i.e. the 'content' string) is correct, and being encoded correctly in the output?<div>
<div></div><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
On Tue, Oct 6, 2009 at 3:40 PM, Rami Chowdhury <<a href="mailto:rami.chowdhury@gmail.com" target="_blank">rami.chowdhury@gmail.com</a>>wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Tue, 06 Oct 2009 13:26:19 -0700, Victor Subervi <<br>
<a href="mailto:victorsubervi@gmail.com" target="_blank">victorsubervi@gmail.com</a>> wrote:<br>
<br>
The code in question is generated automatically from another script. I<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
took<br>
your idea of the \r\n\r\n and added triple quoting and now it prints out<br>
this:<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>
picid = int(form['id'].value)<br>
x = int(form['x'].value)<br>
pics = {1:'pic1',2:'pic2',3:'pic3',4:'pic4',5:'pic5',6:'pic6'}<br>
pic = pics[x]<br>
print '''Content-Type: text/html<br>
<br>
'''<br>
db = MySQLdb.connect(host=host, user=user, passwd=passwd, db=db)<br>
cursor= db.cursor()<br>
sql = "select " + pic + " from products where id='" + str(picid) + "';"<br>
cursor.execute(sql)<br>
content = cursor.fetchall()[0][0].tostring()<br>
cursor.close()<br>
print '''Content-Type: image/jpeg<br>
<br>
'''<br>
print<br>
print content<br>
<br>
<br>
To answer your questions, I have no idea what eNom has done to their<br>
servers, which is where the other site was hosted (never went live), but<br>
am<br>
in the process of building on DreamHost, who seems to be a FAR better<br>
service than eNom, whom I actually had to report to the BBB and they never<br>
fixed or acknowledged very obvious problems. At any rate, the above code<br>
gets the browser to print out all the binary "garbage" that should<br>
translate<br>
into an image (you can look:<br>
<a href="http://13gems.com/stxresort/cart/getpic1.py?id=1&x=1" target="_blank">http://13gems.com/stxresort/cart/getpic1.py?id=1&x=1</a> ). Any more ideas<br>
would<br>
be helpful.<br>
<br>
</blockquote>
<br>
Going to that URL, my browser now tries to render an HTML page, and I can<br>
now see the 'Content-Type: image/jpeg' string being printed into the HTML<br>
source. Have you tried removing the 'Content-Type: text/html' header, with<br>
the new triple-quoted syntax?<br>
<br>
<br>
--<br>
Rami Chowdhury<br>
"Never attribute to malice that which can be attributed to stupidity" --<br>
Hanlon's Razor<br>
408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)<br>
<br>
</blockquote></blockquote>
<br>
<br>
<br>
-- <br>
Rami Chowdhury<br>
"Never attribute to malice that which can be attributed to stupidity" -- Hanlon's Razor<br>
408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)<br>
</div></div></blockquote></div><br>