[mod_python] How do I serve dynamic images?

Colin Bean ccbean at gmail.com
Wed Feb 27 14:44:14 EST 2008


It works the same way; just point the src attribute of your img tag to
the URL for your custom image handler.  You should be able to include
query parameters or whatever else you need in the URL.  Think of the
an img tag as telling the browser "request the source URL, and then
display the request content in the page (if it's a valid image)".

Colin

On Wed, Feb 27, 2008 at 11:25 AM, happybrowndog
<happybrowndog at hotmail.com> wrote:
> I've searched the web but have only seen code to serve dynamically
>  generated images in the following way:
>         buff = StringIO.StringIO()
>         img.save(buff,...)
>         req.write(buff.getvalue())
>  and setting the appropriate html headers.  This is fine if I want to
>  serve the image in its own page.
>
>  But how do I serve dynamically generated images inside an <img> tag?
>
>  * note: I don't want to create the image on disk first, I wish to only
>  serve it directly from python in memory.
>
>  _______________________________________________
>  Mod_python mailing list
>  Mod_python at modpython.org
>  http://mailman.modpython.org/mailman/listinfo/mod_python
>


More information about the Mod_python mailing list