[Zope] MySQLDA and images beeing corrupted

aasmund@polardesign.no aasmund@polardesign.no
Fri, 12 Jan 2001 13:18:45 +0100 (CET)


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