Using CGI to return image files

This CGI script will return a JPG extension file to a JPEG capable browser:


In the HTML document, write a URL such as
<IMG SRC = "/cgi-bin/IMG.cgi?/some/path/picture">
The script will return picture.jpg for Netscape and Mosaic 2.6, otherwise it will return picture.gif.

If cgi scripts may be placed anywhere, then a simpler syntax is possible:
<IMG SRC = "IMG.cgi?picture">

Vancouver Webpages