<?php // @version $Id: default.php 11917 2009-05-29 19:37:05Z ian $

defined('_JEXEC') or die('Restricted access');

?>
<?php
class images{ 
	
	function getImage($image,$width=150,$height=150,$resize=0){
		require_once("thumbLib/ThumbLib.inc.php");
		$imgPath = 'images/stories/thumbs/';
		$img_original = $image;
		$thumb = PhpThumbFactory::create($img_original);
	
		$img = split("/", $img_original);
		$img = $img[count($img)-1];
	
		$img = substr($img,0,strripos($img,'.'));
		$img = $img.'_thumb_'.$width.'_'.$height.'_'.$resize.'.jpg';
	
		if(!file_exists($imgPath.$img)){
			if($resize == 0){
				$thumb->resize($width, $height);
			}else{
				$thumb->adaptiveResize($width, $height);
			}
			$thumb->save($imgPath.$img, 'jpg');
		}
		return $imgPath.$img;
	}
	
	
}
