<?php
/**
 * PhpThumb Library Example File
 * 
 * This file contains example usage for the PHP Thumb Library
 * 
 * PHP Version 5 with GD 2.0+
 * PhpThumb : PHP Thumb Library <http://phpthumb.gxdlabs.com>
 * Copyright (c) 2009, Ian Selby/Gen X Design
 * 
 * Author(s): Ian Selby <ian@gen-x-design.com>
 * 
 * Licensed under the MIT License
 * Redistributions of files must retain the above copyright notice.
 * 
 * @author Ian Selby <ian@gen-x-design.com>
 * @copyright Copyright (c) 2009 Gen X Design
 * @link http://phpthumb.gxdlabs.com
 * @license http://www.opensource.org/licenses/mit-license.php The MIT License
 * @version 3.0
 * @package PhpThumb
 * @subpackage Examples
 * @filesource
 */

require_once '../joomla/libraries/thumbLib/ThumbLib.inc.php';

$width  = 250;
$height = 100;
$imgPath = 'thumb/';
$img = 'test.jpg';

$img_name = substr($img,0,strripos($img,'.'));
$imgToSave = $imgPath.$img_name.'_thumb_'.$width.'_'.$height.'.jpg';

if(!file_exists($imgToSave)){
	$thumb = PhpThumbFactory::create($img);
	//$thumb->adaptiveResize($width, $height)->createReflection(40, 40, 80, true, '#a4a4a4');
	$thumb->adaptiveResize($width, $height);
	$thumb->save($imgToSave, 'jpg');
}
?>
<img src="<?php echo $imgToSave; ?>" />
