I lifted this off some tutorial about a Flickr killr application :-)

    @expose(content_type='image/jpeg')
    def getImage(self, image_id):
        data = Image.get(image_id)
        return (data.image)

On May 11, 10:40 am, Alberto Valverde <[EMAIL PROTECTED]> wrote:
> On May 11, 2007, at 4:13 PM, Francis Lavoie wrote:
>
>
>
> > I have a contact table with a BLOBCol field to store a photo or
> > logo of
> > the contact.
>
> > But now, I have no idea how I can show it in a web page. The only
> > idea I
> > have is to put the data in a temporary file. But that just look like a
> > hack.
>
> > Is someone have a clue or some information I can use?
>
> You could return the stream directly and set the Content-Type header
> accordingly. eg:
>
> def mymethod(self,...):
>         contact= model.get(...)
>         cherrypy.response.headers['Content-type'] = "image/jpeg"
>         return contact.image.read()
>
> Alberto


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to