MSA - Matt's Script Archive SurveyFactory - Create and publish online web surveys
 Matt's Script Archive: Random Image Displayer: ReadmeView All Readme Files @ MSA
 
  Other sites by Matt:
 FormMail.com
  - hosted form processor
 SurveyFactory
  - 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
    FormMail
    Guestbook
    WWWBoard
    Simple Search
    Counter
    TextCounter
    Random Text
    TextClock
    Free for all Links
    Random Link
    HTTP Cookie Library
    Countdown
    Random Image
      > Readme 
      Download
      FAQ
    SSI Random Image
    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 Random Image.
Copyright and Header
Basic Random Image DisplayerVersion 1.2
Copyright 1996-2002 Matt Wrightmattw@scriptarchive.com
Created 07/01/95Last Modified 07/20/95
Matt's Script Archive, Inc.:http://www.scriptarchive.com/

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:
          http://www.scriptarchive.com/faq/
      3) If you are still having difficulty installing this script,
          you may wish to look at the resources listed here:
          http://www.scriptarchive.com/help/

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 NOTICE:
Copyright 1995 - 2002 Matthew M. Wright All Rights Reserved.

Basic 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.
Overview
The Random Image Displayer will allow you to call on different images each time your page is reloaded and accessed. The Random Image Displayer consists of two files, the rand_image.pl and README.

1. rand_image.pl - The perl script that calls on the random image.
2. README - This file (Installation instructions)
rand_image.pl
This is the main file and the one that is called upon every time your page is loaded. You will need to place this file in your server's cgi-bin and give users the permission to read/execute this file. (chmod 755 or chmod a+rx) There are also several variables you will have to define:

 Necessary Variables

  $basedir = "";
This is the http address and base directory that your pictures are placed in. This is in url form. The filenames you specify will be appended to this address. Examples Below.

@files = ("","");
These are all of your files placed into array. The filenames should be reflective of the location of the files relative to your $basedir. Examples Below.

 Options

  $uselog = "";
You can enable the usage of a short log, which will simply log the name of each file as it is accessed. Not very fancy, but it can be useful.

$logfile = "";
The system path to your log file and where you want it kept. Keep in mind that this log file must be placed in a world writable directory. If you don't create a log file, but point the path to a world writeable directory and give it a false filename, the script will create the file for you. This is not a required variable if you turn off $uselog.
Example
Let's say I have 5 files. The directory structure looks like:

/home/mattw/public_html/
                        pics/funny.gif
                        nature/waterfalls.gif
                        pics/cool.gif
                        nature/tree.gif
                        pics/www.gif


Where pics/ and nature/ are directories that these images are located in. Your variables should show as follows:

   $basedir = "http:/host.com/~mattw/";
   @files = ("pics/funny.gif","nature/waterfalls.gif","pics/cool.gif",
             "nature/tree.gif","pics/www.gif");
How do I implement this in my pages?
This file can be used in your pages in one of the following syntaxes. It can do backgrounds, or just plain image references. To activate it do the following:

For a random in-lined image:

   <img src="http://www.ser.ver/cgi-bin/rand_image.pl">

For a random background image:

   <body background="http://www.ser.ver/cgi-bin/rand_image.pl">
Things to be careful of
If you are using it as a random background program, you will want to make sure that all of your backgrounds will work with the specified colors. In other words, if you have a dark and a light image in your random image path it will be hard to find a text color to work in both instances.
History
Version 1.0 07/01/95 - First Created
Version 1.1 07/17/95 - Completely Re-written. Less variables to fill in, added flexibility: including pics in different directories and pics with names unlike others. A big improvement over the last version. You can also have different extensions like .jpg and .gif.
Version 1.2 07/20/95 - Eliminated the $numfiles variable and can now take the random number straight from the array.

 

FormMail.com :: HTML Form to Email Processor
[ Linking to MSA | Advertising Opportunities | Contact Matt ]
© 1995 - 2009 Matt Wright and Matt's Script Archive, Inc.