[Zope-dev] Images in Oracle's BLOB Field
Leonardo Rochael Almeida
leo@hiper.com.br
Tue, 06 Nov 2001 11:30:03 -0200
Juan Javier Carrera Obrero wrote:
> Hello,
Hi,
> I have stored images in a Oracle's BLOB field. I have tried to
> display them from Zope in a dtml-in method, but I can not show
> them.
>
> Anybody knows to how do it ?
First of all, you must understand that html doesn't include it's
displayed images inline in the source document it just puts a reference
('<img src="some url">') telling your browser where it should fetch the
image. Hence when you say <dtml-var some_image_object> it is actually
asking some_image_object to output an <img src="..."> tag. This <img>
tag would be useless if the 'src="..."' part didn't refer to a place
that actually served the image.
Your <dtml-in> of BLOB fields is most likelly spewing a bunch of data in
the html source of your document which your browser is rightfully not
showing you as an image.
The solution to your problem is twofold:
* find a way to query your database and return a list of <img
src="..."> tags.
* find a way to serve ONE image from the same URL you mentioned in
the <img src="..."> above.
There are many aproaches to that, almost all involving the creation of
Zope products, though maybe you can make do with a method to query the
database and another method or script that gets an ID as a parameter and
spews one image in return. Don't forget to set your 'Content-Type:'
header in this method or script.
Cheers, Leo