putting Image from database in cgi app

Gerhard Häring gh at ghaering.de
Wed May 21 08:37:56 EDT 2003


vivek kumar wrote:
> THX a lot for that. But what I want to do is to show the image with some 
> related data. I am working on a shopping cart typo thing (Book Store) 
> and I want to show the image with various details like book name,author 
> etc with the Image (like an IMG tag in a HTML document). Is it possible 
> to do it without creating a temporary file??

Short anser: use the temp file.

Longer answer: It's possible to use two different CGI scripts. One for 
delivering the image, another one for delivering the HTML document. This 
  way you could avoid creating the temp file.

You could even just use one CGI script and dispatch on some parameter 
wether to deliver HTML or image data.

But even then it would be two http requests and the CGI script would be 
called twice, one time for the html, the other time for the image.

In the end, using the temp file is probably the easiest solution, at 
least as long as the web technology you use is CGI.

-- Gerhard





More information about the Python-list mailing list