Changeset 10684 for trunk/admin/include
- Timestamp:
- Apr 29, 2011, 7:10:00 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/include/image.class.php
r10641 r10684 58 58 function __construct($source_filepath, $library=null) 59 59 { 60 global $conf;61 62 60 $this->source_filepath = $source_filepath; 63 61 … … 76 74 } 77 75 78 if (is_null($library)) 79 { 80 $library = $conf['image_library']; 81 } 82 83 // Choose image library 84 switch (strtolower($library)) 85 { 86 case 'auto': 87 case 'imagick': 88 if ($extension != 'gif' and self::is_imagick()) 89 { 90 $this->library = 'imagick'; 91 break; 92 } 93 case 'ext_imagick': 94 if ($extension != 'gif' and self::is_ext_imagick()) 95 { 96 $this->library = 'ext_imagick'; 97 break; 98 } 99 case 'gd': 100 if (self::is_gd()) 101 { 102 $this->library = 'gd'; 103 break; 104 } 105 default: 106 if ($library != 'auto') 107 { 108 // Requested library not available. Try another library 109 return self::__construct($source_filepath, 'auto'); 110 } 111 die('No image library available on your server.'); 76 if (!($this->library = self::get_library($library, $extension))) 77 { 78 die('No image library available on your server.'); 112 79 } 113 80 … … 305 272 return false; 306 273 } 307 @exec($conf['ext_imagick_dir'].'convert ', $returnarray, $returnvalue);274 @exec($conf['ext_imagick_dir'].'convert -version', $returnarray, $returnvalue); 308 275 if (!$returnvalue and !empty($returnarray[0]) and preg_match('/ImageMagick/i', $returnarray[0])) 309 276 { … … 316 283 { 317 284 return function_exists('gd_info'); 285 } 286 287 static function get_library($library=null, $extension=null) 288 { 289 global $conf; 290 291 if (is_null($library)) 292 { 293 $library = $conf['image_library']; 294 } 295 296 // Choose image library 297 switch (strtolower($library)) 298 { 299 case 'auto': 300 case 'imagick': 301 if ($extension != 'gif' and self::is_imagick()) 302 { 303 return 'imagick'; 304 } 305 case 'ext_imagick': 306 if ($extension != 'gif' and self::is_ext_imagick()) 307 { 308 return 'ext_imagick'; 309 } 310 case 'gd': 311 if (self::is_gd()) 312 { 313 return 'gd'; 314 } 315 default: 316 if ($library != 'auto') 317 { 318 // Requested library not available. Try another library 319 return self::get_library('auto'); 320 } 321 } 322 return false; 318 323 } 319 324
Note: See TracChangeset
for help on using the changeset viewer.