Random Image

Started on the old forum in November 2010 · view the original in the archive · old links redirect here

No replies · 755 views · started 16 years ago · 1 min read

wap-ruler Developer · 143 posts #1

its a random images script

$dir = "./images/";  //replace with image directory address
$dh  = opendir($dir);
$a = array();
while ($filename = readdir($dh)) { $filename = $dir.$filename; if (getimagesize($filename)) { $a[]="$filename"; } }
$rand = array_rand($a, 1);
echo "<img src='$a[$rand]' style='max-width:100%;' />";

use thanks button if u like it

ImPoSsIbLe iS nOthInG aS ImPoSsible ItSelF SaYs "I M POSSIBLE"

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close