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

2005-10-27 Thread Chris Withers

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:


  
   
 Name
   
   
 Picture
   
  
  
   
 Test User
   
   
 http://localhost:8080/myproject/getImage?id=1231"/>
   
  


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@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 )


[Zope] Cannot show blob image from sql server

2005-10-25 Thread Thomas G. Apostolou
Hi all,

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.

Any sugestion-solutions-readings would be most apreciated.

Thanks A LOT.
PS : Newbie 8-(




Thomas G. Apostolou
Software Engineer
Θωμάς Γ. Αποστόλου
Μηχανικός Λογισμικού

___
Zope maillist  -  Zope@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 )