How to generate graphics dynamically on the web using Python CGI script?
Steve Holden
steve at holdenweb.com
Fri Jan 20 20:55:10 EST 2006
David Wahler wrote:
> Xavier Morel wrote:
>
>>Steve Holden wrote:
>>
>>>Luiz Geron wrote:
>>>
>>>>I don't have experience on this, but I think that you can make the
>>>>script return the image "contents" directly to the img tag, without
>>>>passing it to a img file, so you can use something like this:
>>>>
>>>><img src="script_that_return_image_contents">
>>>>
>>>>wich saves some processing and I/O.
>>>>
>>>
>>>No it doesn't, because the script that generates the graphic is then a
>>>different script from the one that generates the referring HTML. I agree
>>>that scripted generation of the graphical content is a viable option
>>>that I overlooked, though it seems from the OP's inquiry that he already
>>>uses CGI to generate the HTML.
>>>
>>>regards
>>> Steve
>>
>>Generate inline base64 encoded images in your HTML page and you're done.
>>(yes, this is ugly, but it generates both HTML and graphics in the same
>>script)
>
>
> I believe that won't work with Internet Explorer (although it's been a
> while since I checked).
>
Nowadays I tend to reject non-portable solutions without really thinking
about them. This can be a bugger, as sometimes a non-portable solution
would do, but generally speaking I prefer to talk in terms that make
sense on as many platforms as possible.
In this instance I did completely overlook data: URLs. Only the OP knows
whether they would help in that specific case, so the suggestion might
have been useful.
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/
More information about the Python-list
mailing list