[Zope] MySQLDA and images beeing corrupted

2001-01-12 Thread aasmund


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  -  [EMAIL PROTECTED]
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 )




RE: [Zope] MySQLDA and images beeing corrupted

2001-01-12 Thread Max Møller Rasmussen

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]

Any ideas?
I feel like I am *so* close to making this work!

It sounds like you have some sort of escape problem, with special characters
being handled as text.

Don't you have to treat the image as text when inserting them into mySQL and
then escape special characters? I betcha there is a special function for
that. Try it.

regards Max M

___
Zope maillist  -  [EMAIL PROTECTED]
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 )




Re: [Zope] MySQLDA and images beeing corrupted

2001-01-12 Thread Phil Harris

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: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
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  -  [EMAIL PROTECTED]
 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 )


___
Zope maillist  -  [EMAIL PROTECTED]
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 )