#native_company# #native_desc#
#native_cta#

Random Image Class

By einav
on September 10, 2001

Version: 1.0

Type: Class

Category: HTML

License: GNU General Public License

Description: this simple class is used to show a random image from an array of image paths.
see class for usage..

class RndImage{
/********************************************************************
* Random Image Class
* Version: 1.0
* Date: 9/9/2001
* License: GPL
* Author: einav brill 
* Contact: [email protected]
* Description: 
*  	this simple class is used to show a random image from an array
* 	of image paths.
* Functions:
*	setPath(image_path) is used to set the images path.
*	insertRndImage(imgs) used to get a list of images path
*	getRndImage() return a random image path
* Usage:
* $rndImg = new RndImage();
* $rndImg->setPath('images/rotating_images/');
* $rndImg->insertRndImage('image_1.jpg','image_2.jpg','image_3.jpg',etc..);
* HTML....<? echo $rndImg->getRndImage(); ?>.....HTML 
**********************************************************************/
var $_path ;
var $_imgArray ;

function setPath($pathName){
$this->_path = $pathName;
}    

function insertRndImage($imgs)
{
$imgArraySize = func_num_args();
 for($imgNum=0;$imgNum<$imgArraySize;$imgNum++)
  {
  $this->_imgArray[$imgNum] = $this->_path.func_get_arg($imgNum);
  }
}

function getRndImage(){
srand ((double) microtime() * 1000000);
$rndValue = rand(0,sizeof($this->_imgArray)-1);
return $this->_imgArray[$rndValue];
 }
}