MSA - Matt's Script Archive SurveyFactory - Create and publish online web surveys
 Matt's Script Archive: SSI Random Image Displayer: ReadmeView All Readme Files @ MSA
  Other sites by Matt:
  - hosted form processor
  - hosted survey software
 CGI Resource Index
  - 3,000+ Perl Scripts!
 PHP Resource Index
  - 2,000+ PHP Scripts!
 chumpsoft, inc.
  - online survey software

  Matt's Script Archive
    Simple Search
    Random Text
    Free for all Links
    Random Link
    HTTP Cookie Library
    Random Image
    SSI Random Image
      > Readme 
    TextCounter C++
    TextClock C++

Table of Contents
Select from the following table of contents to jump to a specific area within this README file. This is a HTML version of the README file distributed with SSI Random Image.
Copyright and Header
SSI Random Image DisplayerVersion 1.2
Copyright 1996-2002 Matt
Created 07/01/95Last Modified 11/4/95
Matt's Script Archive, Inc.:

If you run into any problems while trying to configure this scripts, help is available. The steps you should take to get the fastest results, are:
      1) Read this file thoroughly.
      2) Consult the Matt's Script Archive Frequently Asked Questions:

      3) If you are still having difficulty installing this script,
          you may wish to look at the resources listed here:

Hopefully that will be able to help you solve your problems. Due to time constraints I can no longer offer technical support for this code.

Copyright 1995 - 2002 Matthew M. Wright All Rights Reserved.

SSI Random Image may be used and modified free of charge by anyone so long as this copyright notice and the comments above remain intact. By using this code you agree to indemnify Matthew M. Wright from any liability that might arise from its use.

Selling the code for this program without prior written consent is expressly forbidden. In other words, please ask first before you try and make money off of my program.

Obtain permission before redistributing this software over the Internet or in any other medium. In all cases copyright and header must remain intact.
This script is provided to allow you to have a random image appear on your page every time it is reloaded. The server side includes version offers you link flexibility as well as coinciding random alt text and other variables which make it slightly more advanced than the Basic Random Image Displayer.

There are two files included with this script.

1. README - This file, which explains installation.
2. - The perl script which chooses the random image.
Below is a list of the changes that must be made to the file in order for it to choose your random images correctly:

Inside the script you will see a list of variables, which must be defined in order for your script to work. Below is a description of how to define each one:

 Necessary Variables

  $basedir = "";
The standard portion of my url for each image. This is the base location of each image that is referenced in the next array @images. The random image name chosen out of @images will be appended later on in the script to form a complete url.

@images = ("first_image.gif","second_image.jpg","third_image.gif");
This is the name of each image. They can be whatever format you would like, just make sure that when each of these filenames is appended to $basedir, they form a complete url path to the image.

@urls = ("http://url_linked/to/first_image", "http://url_linked/to/second_image", "http://url_linked/to/third_image");
If you want each image to be accompanied with a link, then this is your chance to do it. If you leave a field blank, then the script will assume you do not have a url for that image and it will not link the image to anything. So therefore, if you did not have a link for the second image in the example above you could do:

   @urls = ("http://url_linked/to/first_image",

@alt = ("First WWW Page","Second WWW Page","Third WWW Page");
This is the same idea as the @urls array. Each of these alt text fields corresponds to the image located in the same array spot in @images, as well as the same url located in the @urls array. If you don't want the alt text for a certain image just leave the field blank as in the example of @urls above.


  There are also a number of options that you will need to define and decide whether to use. They are located directly below the variables in the script.

$uselog = "1";
At this point you must decide whether or not you want to use the logging feature. for most practical purposes this will not be used, but some people may find it helpful either for keeping stats or seeing which images get picked the most. All the logging feature will record is the image, date, and remote host that saw the image. Should you choose to turn this option on, you will need to define two more variables:

   $logfile = "/home/mattw/public_html/links/ssi_image";
   The location of the log file. This must be in a readable/writable directory
   and given read/write permissions for all users so that the server's uid may
   edit the log file.

   $date = `/usr/bin/date`; chop($date);
   This is the location of your date function enclosed in '`' so that it will be
   executed when it is called upon. It returns the date function for logging
   purposes only.

$link_image = "1";
If you turn this variable off you do not need to worry about what is in the @urls variable. It simply won't link any of your images.

$align = "left";
This is the way in which you want your image aligned. Valid choices for Netscape include: left, right, middle, absmiddle, bottom, and absbottom.

$border = "2";
If you turn this variable off you do not need to worry about what is in the @urls variable. It simply won't link any of your images.

You can turn off both align and border by setting them equal to "" like: $align = ""; or $border = "";
Server Side Includes
I hope that you already know how to accomplish a Server Side Includes, and therefore I am not going to go into detail about how. Two things you can check for are:

1. Ask your sysadmin if you have access to server side includes and what you need to change about your file to make them work. This often involves changing your .html files to .shtml.

2. If you really don't know anything about Server Side Includes, you can check out a great tutorial that NCSA has developed; located at:
Version 1.1 09/30/95 - Corrections made to random image displayer to add functionality of alt text, links, etc... to each random image..
Version 1.2 11/04/95 - Errors in alt="" tag not being noticed correctly, and spacing being messed up fixed! :: HTML Form to Email Processor
[ Linking to MSA | Advertising Opportunities | Contact Matt ]
© 1995 - 2009 Matt Wright and Matt's Script Archive, Inc.