CGI-Python Image viewing

Steve Holden sholden at holdenweb.com
Thu Feb 8 09:57:42 EST 2001


Mix" <mix77 at usa.net> wrote in message
news:95tp4p$bev$1 at ctb-nnrp2.saix.net...
> I am new to CGI scripting AND Python. What I am trying to do is,
> display an image on an html page that has been retrieved from a Postgre
> database
> using Python (cgi). My problem is : that image that not show up on the
page,
> regardless of where it is sitting on my html or cgi directory!
> (I am running Apache Web server under Redhat 7.0 with the default linux
> kernel).
> But, I CAN display the image on a plain html page (i.e without the
> scripting).
>
> Please help!
> Thanks
>
>
Perhaps you should give us a little more information: for example, is it the
HTML you are retrieving from Postgres, or the image as well? An example of
the generated / retrieved HTML would be useful.

Generally speaking you should be sending HTML to the client with an <img
src="..."> tag in it to specify the location of the graphic. If the value of
the "src" attribute is absolute (begins with a /) then the browser will
request by sending a path from the server's root. If, on the other hand,
it's relative (does not begin with a /) then the browser will request it by
generating an absolute path based on the URL which was used to access the
HTML.

All this assumes you haven't put <BASE> tagging in your HTML.

Does this help?

regards
 Steve





More information about the Python-list mailing list