[Zope] Viewing a Blob using DTML

working4aliving working4aliving@hotmail.com
Thu, 21 Nov 2002 12:12:54 -0500


Thanx Matt and Maik... You both steered me, and it works... (needless to
say, I'm pretty damn happy right now :))) )
Seems like I didn't need the RESPONSE.setheader (yet???)

Here's the method (requestImage1)

<form action="selectImage1">
<input type="text" name="Id"><br>
<input type="submit">
</form>

Here's the python script(selectImage1)
#image1 is the name of the field
result = []
lob = ['image1']
for row in context.sql_db_image1(id=id):
  lob = row['image1']
return lob



----- Original Message -----
From: "Matthew T. Kromer" <matt@zope.com>
To: "working4aliving" <working4aliving@hotmail.com>
Cc: <zope@zope.org>
Sent: Thursday, November 21, 2002 11:28 AM
Subject: Re: [Zope] Viewing a Blob using DTML


> working4aliving wrote:
>
> >Hi, I've been working on this for a little, and am stuck... I'm a newbie
> >with zope.
> >I have a python script that calls a zsql method (mysql), and DOES display
> >the image correctly.
> >
> >(calling the zsql method does not, by the way, it only displays "machine
> >code" (old joke.hahaha;) , but that's ok, I think)
> >
> >When I type the url directly into the browser, and insert my id variable
for
> >the record, it'll work from the browser, but I can't get it to work
through
> >dtml.  It will only display the "machine code".
> >
> >Is there a way to just call the url from dtml while inserting the ID
> >variable at  the end? I'm pretty stuck on this, and could really use an
> >expert
> >
> >Here's the python url that works...
> >
> >http://localhost:8080/blobTest/selectImage1?id=12686
> >
> >Is this the easiest way to do it?  I've found some various documentation
on
> >the web, and although helpful, just doesn't get me there....
> >
> >
> >
>
> Most likely you need to set the proper content-type header, and make
> sure no "extra" stuff goes out on the page besides the image.
>
> For example:
>
> <dtml-call RESPONSE.setHeader('content-type', 'image/jpeg')
>  ><!-- Note clever use of line wrap inside tag!
> --><dtml-var "selectImage(id=12686)">
>
> --
> Matt Kromer
> Zope Corporation  http://www.zope.com/
>
>
>
> _______________________________________________
> 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 )
>