Change your dtml to: <dtml-in hent_bilde> <dtml-call "RESPONSE.setHeader('Content-Type', 'image/gif')"> <dtml-call "RESPONSE.setHeader('Content-Length', _.len(bildefil))"> <dtml-return bildefil> </dtml-in> hth Phil ----- Original Message ----- From: <aasmund@polardesign.no> To: <zope@zope.org> Sent: Friday, January 12, 2001 12:18 PM Subject: [Zope] MySQLDA and images beeing corrupted
I am using Zope 2.3a2, and MySQLDA 1.1.3, with one patch installed (it was supposed to fix problems with autoincrement fields)
Everything is installed, with no apparent problems.
I would like to store images as BLOBs in a MySQL database (version 3.22)
I am able to store the images in the database, but somehow, along the way, they become corrupted, and show up in the browser as a corrupted image. I can, howover, recognize some of the features of the original image. The top part is mostly intact, and the colours seem right.
The image is retreived from the database like this: method named "image", with everything *on one line*.
<dtml-in hent_bilde> <dtml-call "RESPONSE.setHeader('Content-Type', 'image/gif')"> <dtml-call "RESPONSE.setHeader('Content-Length', _.len(bildefil))"> <dtml-var bildefil> </dtml-in>
With "hent-bilde" as follows:
select * from bilder where <dtml-sqltest id type=int>
The URL used is: "..../image?id=10"
The image is stored in the database as follows:
insert into bilder (bildefil, kilde, kommentar, bildetype)
values (
<dtml-sqlvar "REQUEST['bildefil'].read()" type=string>,
<dtml-sqlvar kilde type=string>, <dtml-sqlvar kommentar type=string>, <dtml-sqlvar bildetype type=string> );
Any ideas?
I feel like I am *so* close to making this work!
Åsmund Hjulstad
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )