All pastes #394335 Raw Edit

Stuff

public php v1 · immutable
·published 2007-03-14 06:57 UTC
rendered paste body
In one of my forums was a discussion about, how to change an image randomly, so i wrote this code using mt_rand .... I hope you can use it .... <?php   //ImageChange.php   error_reporting(0);//hide the notice for the missing $iRand  $sPath2ImageDir = Path;//preventing redundancy  $aImages         = scandir($sBildOrdnerPfad);//Dir 2 Array  $iImageCount     = count($aImages);//preventing redundancy   while (getimagesize("{sPath2ImageDir}/{$aImages[$iRand]}")) {//recursion to get an image    $iRand = mt_rand(2, $iImageCount-1);//min = 2 because $aImages[0] = "." and $aImages[1] = ".."     echo "<img alt=\"Image{$iRand}\" src=\"{sPath2ImageDir}/{$aImages[$iRand]}\" title=\"Image{$iRand}\" />";//show the image  unset($aImages, $iImageCount, $iRand, $sBildOrdnerPfad);//if this script is used in another script?>----Server IP: 217.13.201.10Probable Submitter: 84.62.136.33----