Click to See Complete Forum and Search --> : variable images


mesial
12-02-2005, 09:14 AM
I'm looking to embed an image into a web page that changes every time the page is visited or refreshed. Help would be very much appreciated! :)

bokeh
12-02-2005, 11:29 AM
You can't embed an image in an html page. It's just not possible. If you want to server a random image use PHP to serve a random image tag as explained in this thread. (http://www.webdeveloper.com/forum/showthread.php?t=87151)

mesial
12-04-2005, 01:28 PM
I don't think I have php with my host. To be more acurate in my desire, I'm looking at making a variable image for my avatar in the various forums I belong to. I think I found what I'm looking for, but don't know where to place/use it. I am not too familiar with CGI scripts, and don't see a forum section here for it so I posted here. This is what I found:
Generating random images

Some people want to have a random image on their page. It is fairly simple to do with a cgi-program. Put the following on the place you want to have the image:

<img src = "/path/to/script">

The program assumes all the gifs to choose from are in a specific directory, say /%7Eabigail/Images/, and are named ball_0.gif .. ball_8.gif. The following then is enough for the program random_gif:

#!/usr/bin/perl -w
$MAX = 9;
$SERVER = "www.fnx.com";
$DIR = "/%7Eabigail/Icons";
$FILE = "ball_";
$EXT = "gif";

srand (time^$$);
$index = int (rand ($MAX));

print "Location: $SERVER/$DIR/$FILE$index.$EXT\n\n";
exit (0);


My question is:
Where do I put or what do I do with the second part?

mesial
12-05-2005, 05:33 PM
I think i've got it figured out