PHP - Random Image Script Generator

Refresh a few times for a demo.

Selects a image url at random. Image width, height and a couple urls are required.

width:   height:
Thats all folks!
copy to clipboard
<?php
#construct the images Array
$images=array("{{url1}}","{{url2}}","{{url3}}","{{url4}}","{{url5}}","{{url6}}","{{url7}}","{{url8}}","{{url9}}","{{url10}}","{{url11}}","{{url12}}","{{url13}}","{{url14}}","{{url15}}");

#constuct the random file selector
$n=count($images);
$num=rand(0, ($n-1));
$image=$images[$num];

#send the image to the browser
print "<img src='$image' style='width:{{imgw}}px; height:{{imgh}}px;' alt=''>";
?>
Christmas Card
Riverdrift.com   
2000 - 2024 Hand Made in the U.S.A