Weather Commerce

CAM - Random Image

{kl_php} // print a random image. Don't forget ending slash! // setting $type to 'all' will return all images. function getRandomImage($dir,$type='random') { global $errors; if (is_dir($dir)) { $fd = opendir($dir); $images = array(); while (($part = @readdir($fd)) == true) { clearstatcache(); if ( eregi("(gif|jpg|png|jpeg)$",$part) ) { if ( !(eregi("_thb_",$part)) ) { $images[] = $part; } } } // adding this in case you want to return the image array if ($type == 'all') { return $images; } // Be sure to call srand() once per script srand ((double) microtime() * 1000000); $key = rand (0,sizeof($images)-1); return $dir . $images[$key]; } else { $errors[] = $dir.' is not a directory'; return false; } } global $my; if (!$my->id) { echo "

This image is restricted to our Members.

Please register and/or log in to view.

"; } else { echo '
'; $randomimage = getRandomImage('images/stories/easygallery/18/'); print 'Random Archive Image'; echo '
'; }; {/kl_php}
Disclaimer:
Monkspath Weather Station (MWS) is run as an amateur weather station and therefore should not be used as official data.
Whilst every effort is made to keep the data as accurate as possible no guarantee is given that the data meets the requirements of the Meteorological Offices' 'A' Stations.
The weather station data is produced by MWS and MWS claims copyright over all data produced and disseminated by it.
Members of MWS may use the data produced by MWS for non-commercial use and no other purpose.
If MWS data is used according to these licence terms then the data must be acknowledged as belonging to MWS and reproduced with its permission.
The weather station data produced by MWS must not be used for decision making of any kind.
The weather station is privately owned and the owners do not make any claims as to the accuracy of the information collected by the equipment.