| [ Index ] |
PHP Cross Reference of Limb3 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 * Limb PHP Framework 4 * 5 * @link http://limb-project.com 6 * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com) 7 * @license LGPL http://www.gnu.org/copyleft/lesser.html 8 */ 9 lmb_require('limb/fs/src/lmbFs.class.php'); 10 lmb_require('limb/imagekit/src/lmbImageFactory.class.php'); 11 lmb_require('limb/net/src/lmbMimeType.class.php'); 12 lmb_require('limb/cms/src/model/lmbCmsFileObject.class.php'); 13 14 /** 15 * class lmbCmsImageFileObject. 16 * 17 * @package cms 18 * @version $Id: lmbCmsImageFileObject.class.php 5945 2007-06-06 08:31:43Z pachanga $ 19 */ 20 class lmbCmsImageFileObject extends lmbCmsFileObject 21 { 22 protected $image_library; 23 24 function resize($max_size) 25 { 26 $input_file = $this->getFilePath(); 27 $output_file = lmbFs :: generateTmpFile(); 28 29 try 30 { 31 $image_library = lmbImageFactory :: create(); 32 33 $input_file_type = $image_library->getImageType($this->getMimeType()); 34 $output_file_type = $image_library->fallBackToAnySupportedType($input_file_type); 35 36 $image_library->setInputFile($input_file); 37 $image_library->setInputType($input_file_type); 38 39 $image_library->setOutputFile($output_file); 40 $image_library->setOutputType($output_file_type); 41 42 $image_library->resize(array('max_dimension' => $max_size));//ugly!!! 43 $image_library->commit(); 44 } 45 catch(lmbException $e) 46 { 47 if(file_exists($output_file)) 48 unlink($output_file); 49 50 throw $e; 51 } 52 53 $this->loadFile($output_file); 54 $this->setMimeType(lmbMimeType :: getMimeType($output_file_type)); 55 56 unlink($output_file); 57 } 58 } 59 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Fri Dec 5 04:05:07 2008 | Cross-referenced by PHPXref 0.7 |