<?php
defined("_JEXEC") or die();

jimport('joomla.filesystem.folder');

class  mod_elastslideHelper {
	
	public function getImagesFromFolder($params) {
		$imgs = array();
		
		$imageFolder = JPATH_BASE.'/images/'.$params->get('imagefolder');
		$filesFromFolder = JFolder::files($imageFolder);
		
		foreach($filesFromFolder as $image) {
			$imgpath = JUri::base().'images/'.$params->get('imagefolder').'/'.$image;
			array_push($imgs, $imgpath);
		}
		
		return $imgs;
	}
	
	public function getImages($params) {
		$imgs = array();
		
		$i = 1;
		while($i < 10) {
			$listitem = array();
			
			if($params->get('image'.$i) && $params->get('image'.$i.'customlink') != '') {
				$listitem['link'] = $params->get('image'.$i.'customlink');
				$listitem['img'] = JUri::base().$params->get('image'.$i);
				
				array_push($imgs,$listitem);
				
			}
			else if($params->get('image'.$i) && $params->get('image'.$i.'customlink') == '') {
				$listitem['img'] = JUri::base().$params->get('image'.$i);
				array_push($imgs,$listitem);
			}
			
			
			$i++;
		}
		
		return $imgs;
	}
}
?>