IT Web Development Help Pages

Using randomimage.cgi

Print this pagePrint this page

Questions should be directed to Web Development, it-webdev@udel.edu

Use this program to display a different image on a web page every time the page is loaded.

Note: All images MUST be jpg image format and MUST have the suffix ".jpg" (NOT ".jpeg"). The file names themselves can be anything. It is recommended that the files used all have the same dimensions (same height and width). Otherwise, the web page layout may become distorted as each image is loaded.

Steps:

  1. Create a subdirectory within your department web directory in which to store the image files. The department web directory and images must be on the main UD web server (copland or mahler). You cannot call images that exist on a departmental server.

  2. Copy your images into the directory you just created.

  3. In your web page HTML, use the following statement in the image location:

    <img src=http://www.udel.edu/cgi-bin/randomImage?dir=PATH_TO_IMAGES>

    Replace PATH_TO_IMAGES with the path to the directory containing your images. Add height and width attributes and a generic alt tag for good measure. For example, if your images are in the directory /www/htdocs/registrar/images/fall/, your image tag would read

    <img src="http://www.udel.edu/cgi-bin/randomImage?dir=/www/htdocs/registrar/images/fall/" width="100" height="150" alt="Fall photo">

View the source of the UD Home Page for an example of this technique.