You could use a database, but if you just want a low maintainance method
make a tab deliminated text file eg;
image1.jpg This is the first image
image2.jpg This is the second image
image3.jpg This is the thrid image
Now of course the image names will reflect the images in your rotate
directory and you will want your php to look a little like this
<?php
$altMap = file("altmap.txt"); // read the file into an array
$randID = rand(0,count($altMap)-1); // minus one cause the array begins with
0
$useImage = explode("\t",$altMap[$randID]);
echo "<img src=\"".$useImage[0]."\" alt=\"".$useImage[1]."\" />
?>
I haven't tested it but im pretty sure that should work, give it a go.
Marc.
PS the paths also assume all the files are in the one directory.
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 22, 2004 3:40 PM
Subject: [WSG] Accessible image rotators
> hello,
>
> i am using a image rotator php script in the home page of the site. The
problem will image rotator scripts either in PHP or Javascript is that, they
rotate the images from a particular folder randomly. But when you validate,
the image will not have "alt" tag or a "title" tag to make it accessible.
>
> How do i make that.
>
> any ideas.
>
> narain
>
> R.L. Narayan
> +91-98401 08007
>
>
> *****************************************************
> The discussion list for http://webstandardsgroup.org/
> See http://webstandardsgroup.org/mail/guidelines.cfm
> for some hints on posting to the list & getting help
> *****************************************************
>
*****************************************************
The discussion list for http://webstandardsgroup.org/
See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
*****************************************************