[Zope] Retrieving an image from MySQL

Bart Jansen bart.jansen at esac.climbing.nl
Tue Jun 28 07:28:04 EDT 2011


Hi Jibin,

You are now trying to put an image file (the actual image data) into the 
src attribute of your <img> tag. I think the src attribute should 
contain the url pointing to your StockChartManagePreview_Handler script.

This is, assuming that your script does correctly return the image file.

Bart

Op 28-06-11 05:56, Jibin K.J schreef:
> 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
>
>
>
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> https://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>   https://mail.zope.org/mailman/listinfo/zope-announce
>   https://mail.zope.org/mailman/listinfo/zope-dev )


More information about the Zope mailing list