* * @version $Id$ * */ /** * * Class for image manipulation * * @category Abovo * * @package Abovo_Image_Avatar * */ class Abovo_Image_Avatar extends Solar_Base { /** * * Config keys * * @var array * */ protected $_Abovo_Image_Avatar = array( 'path_small' => '/tmp', 'path_big' => '/tmp', 'size_small' => array( 'width' => 40, 'height' => null, ), 'size_big' => array( 'width' => 100, 'height' => null, ), ); /** * * Image manipulation class * * @var Abovo_Image_Adapter * */ protected $_obj_image; /** * * Constructor * * @return void * */ public function __construct($config = null) { parent::__construct($config); // fix paths $this->_config['path_small'] = Solar::fixdir($this->_config['path_small']); $this->_config['path_big'] = Solar::fixdir($this->_config['path_big']); } /** * * Create both, small and big image * * @return void * */ public function createAll($file) { $this->createSmall($file); $this->createBig($file); } /** * * Creates and saves small image * * @return void * */ public function createSmall($file, $handle) { $image = Solar::factory('Lux_Image'); $image->load($file); // resize image $image->resize( $this->_config['size_small']['width'], $this->_config['size_small']['height'] ); // save image $image->save( $this->_config['path_small'] . $this->getName($handle) . '.jpg' ); } /** * * Creates and saves big image * * @return void * */ public function createBig() { } /** * * undocumented function * * @return void * */ public function smallExists($handle) { $file = $this->_config['path_small'] . $this->getName($handle) . '.jpg'; if (file_exists($file)) { return true; } return false; } /** * * Creates image name * * @return void * */ public function getName($handle) { return hash('md5', $handle); } }