[Zope] blob image from MySql
Adriano
adriano at euma.com
Mon Feb 28 19:04:53 EST 2005
Dear Zope friends,
I can't manage my Zope to correctly serve an image retrieved from a
MySql table.
If the thing has been discussed already, I'm sorry, but I couldn't
find so much help, on line.
I followed indications at http://www.zope.org/Members/murphy/MySQL-BLOBs
I have the following ZSQLMethod, named "trovaImmagine" (in Italian
that means findImage)
select iconmimetype, iconblob from webs where
<dtml-sqltest id op="eq" type="int">
Then, I have a Python script (displayImage2)
# Return a string identifying this script.
record = context.trovaImmagine(id = 1)
data = record[0].iconblob
contentType = record[0].iconmimetype
RESPONSE.setHeader('content-type', contentType)
return data
#return len(data)
#return contentType
The commented returns are some tests I made.
When I comment the "return data" part and uncomment the "return
contentType" OR "return len(data)", it seems to work correctly
BUT
when I try to return "data" I obtain a message error from FireFox, saying:
"The image "http://localhost:8080/sql/displayImage2" cannot be
displayed, because it contains errors."
I tyied with Safari and it downloads a "displayImage2" file , I
rename it to displayImage2.jpg, I try to open it with the Apple
viewer (Anteprima in Italian, I don't remember in English) AND it
says me that the file is not a jpeg file as it seems.
Internet Explorer shows a broken QuickTime icon.
What's going on ?
I'm trying to convince a company to port their little app made of
JSPs to Zope and I am doing some tests.
They have the pictures in some blob fields so this is unavoidable, I think
Thanks so much
Catonano
--
" One of the tricks here is to get away from thinking that programs
have to be composed with only a simple text editor "
- Alan Kay -
"Java and C++ make you think that the new ideas are like the old ones.
Java is the most distressing thing to hit computing since MS-DOS".
- Alan Kay -
"The computer revolution hasn't started yet. Don't be misled by
the enormous flow of money into bad defacto standards for
unsophisticated buyers using poor adaptations of incomplete ideas".
-Alan Kay -
More information about the Zope
mailing list