SharronH
10-18-2003, 05:40 AM
OK guys.... I need some help finishing this code. What I wanted to do is to put a [img]http:///www.forumxxx.com/forum/image.php[/img.] in the signature field and have it randomly show a sig in the "images" folder. I have like 8 different sigs and I want it to randomly show one each time a page is refreshed.
Here's the php file. It works great when you call it on IE but when I put the img code in the signature profile, it won't show it on the thread. Any help please?
require("./global.php");
$dir=opendir("/home/example/public_html/forum/images/");
//This is the directory route to the folder
$directory="images/";
//This is a relative link to the directory if it is not in the same directory as the file you are displaying the images on
$pattern="\.(gif|jpg|jpeg|png|bmp|swf)$";
if(!$dir)
{
die("Failed to read directory");
}
$s=readdir($dir);
$count="0";
$image;
while($s)
{
if(ereg($pattern, $s))
{
$image[$count]=$s;
$count++;
}
$s=readdir($dir);
}
closedir($dir);
//Spit it out
$limit=count($image);
$limit--;
$randNum=rand(0,$limit);
$size=getimagesize("$directory$image[$randNum]");
echo "<br><img src=\"$directory$image[$randNum]\" $size[3]>";
?>
Here's the php file. It works great when you call it on IE but when I put the img code in the signature profile, it won't show it on the thread. Any help please?
require("./global.php");
$dir=opendir("/home/example/public_html/forum/images/");
//This is the directory route to the folder
$directory="images/";
//This is a relative link to the directory if it is not in the same directory as the file you are displaying the images on
$pattern="\.(gif|jpg|jpeg|png|bmp|swf)$";
if(!$dir)
{
die("Failed to read directory");
}
$s=readdir($dir);
$count="0";
$image;
while($s)
{
if(ereg($pattern, $s))
{
$image[$count]=$s;
$count++;
}
$s=readdir($dir);
}
closedir($dir);
//Spit it out
$limit=count($image);
$limit--;
$randNum=rand(0,$limit);
$size=getimagesize("$directory$image[$randNum]");
echo "<br><img src=\"$directory$image[$randNum]\" $size[3]>";
?>