[Zope] Retrieving an image from MySQL

Jibin K.J jibinjohn at gmx.com
Mon Jun 27 23:56:50 EDT 2011


I have an image stored in MSQL.(Don't tell me its not proper do that,I know already).Anyways I need to display it in DTML.

 StockChartManagePreview (DTML)

 <dtml-var standard_html_header>
 <img src="StockChartManagePreview_Handler">
 <dtml-var standard_html_footer>

 StockChartManagePreview_Handler (python script)

 request = container.REQUEST
 response = request.RESPONSE
 photo = context.StockChartManage_getImage(ID = 6666)
 context.REQUEST.RESPONSE.setHeader('content-type','image/jpeg')
 return photo[0].image.read()
 #I already tried - return photo[0].image
 #it gives an error image cannot be displayed because it contains errors


 StockChartManage_getImage (Z SQL Method)

 SELECT image
 FROM `imagebase`
 WHERE imageID =<dtml-sqlvar ID type="string">


 Now my problem is that Zope asks for a login every time I view the DTML (StockChartManagePreview )

 Please Help.

 ref : https://mail.zope.org/pipermail/zope-db/2004-July/003336.html 
http://www.zope.org/Members/murphy/MySQL-BLOBs
 http://www.gossamer-threads.com/lists/zope/db/168437 http://www.zope.org/Members/murphy/MySQL-BLOBs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20110628/1e36d51c/attachment.html 


More information about the Zope mailing list