[Zope] Re: Cannot show blob image from sql server

Thomas G. Apostolou thomas.info at hol.gr
Tue Nov 1 06:19:13 EST 2005


Thank you very much Chris that what a lot of help.
As i heve told you i am a niewbie to the whole concept of web and python.
"write this data to the RESPONSE object" was a very very big "here is the
problem" for me!
Some more reading now and i hope i am there for the evil BLOBS. 8-)

Thank you very much!

Thomas


"Chris Withers" <chris at simplistix.co.uk> wrote in
message news:4361017C.3060903 at simplistix.co.uk...
> Thomas G. Apostolou wrote:
> > i have made an external method to connect and get data from an sql
> > server 2000, and then show them in a table. All works fine but one of
> > the columns i retrieve is a BLOB image witch makes my external method
> > to crash. So i used z SQL Method (witch is not prefared because there
> > is a lot of customization and that's why i used External Method with
> > Python from the begining) and it goes fine with retrieving and showing
> > the data. But still i cannot show the BLOB image as image. It shows as
> > a very very long string.
>
> You will need to do at least one query for the data and one request for
> each of the images.
>
> eg, you "main method" returns html like:
>
> <table>
>    <tr>
>     <th>
>       Name
>     </th>
>     <th>
>       Picture
>     </th>
>    </tr>
>    <tr>
>     <td>
>       Test User
>     </td>
>     <td>
>       <img src="http://localhost:8080/myproject/getImage?id=1231"/>
>     </td>
>    </tr>
> </table>
>
> You then need to implement getImage to:
> - do the SQL select to get the image data based on the id
> - write this data to the RESPONSE object
>   (see lib/python/OFS/Image.py's index_html method for an example)
> - set a content-disposition header so that the browser does the right
>    thing
>
> Hopefully soon you'll realise the fundamental issue with http that
> you're bumping into: you don't return a fully rendered page, you return
> a page with references in it to css/javascript/image files that are used
> to render the final page, and that storing binary data in relational
> databases is evil ;-)
>
> Chris
>
> --
> Simplistix - Content Management, Zope & Python Consulting
>             - http://www.simplistix.co.uk
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )
>





More information about the Zope mailing list