Changeset 11044
- Timestamp:
- May 25, 2011, 12:02:24 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/include/image.class.php
r10713 r11044 246 246 } 247 247 248 private function get_resize_result($destination_filepath, $width, $height, $time )248 private function get_resize_result($destination_filepath, $width, $height, $time=null) 249 249 { 250 250 return array( … … 254 254 'height' => $height, 255 255 'size' => floor(filesize($destination_filepath) / 1024).' KB', 256 'time' => number_format((get_moment() - $time) * 1000, 2, '.', ' ').' ms',256 'time' => $time ? number_format((get_moment() - $time) * 1000, 2, '.', ' ').' ms' : null, 257 257 'library' => $this->library, 258 258 ); … … 317 317 { 318 318 // Requested library not available. Try another library 319 return self::get_library('auto' );319 return self::get_library('auto', $extension); 320 320 } 321 321 } … … 399 399 var $imagickdir = ''; 400 400 var $source_filepath = ''; 401 var $image_data = array(); 401 var $width = ''; 402 var $height = ''; 402 403 var $commands = array(); 403 404 … … 407 408 $this->imagickdir = $imagickdir; 408 409 409 $command = $imagickdir.'identify - verbose"'.realpath($source_filepath).'"';410 $command = $imagickdir.'identify -format "%wx%h" "'.realpath($source_filepath).'"'; 410 411 @exec($command, $returnarray, $returnvalue); 411 if($returnvalue )412 if($returnvalue or !preg_match('/^(\d+)x(\d+)$/', $returnarray[0], $match)) 412 413 { 413 414 die("[External ImageMagick] Corrupt image"); 414 415 } 415 416 416 foreach($returnarray as $value) 417 { 418 $arr = explode(':', $value, 2); 419 if (count($arr) == 2) 420 { 421 $this->image_data[trim($arr[0])] = trim($arr[1]); 422 } 423 } 417 $this->width = $match[1]; 418 $this->height = $match[2]; 424 419 } 425 420 … … 431 426 function get_width() 432 427 { 433 preg_match('#^(\d+)x#', $this->image_data['Geometry'], $match); 434 return isset($match[1]) ? $match[1] : false; 428 return $this->width; 435 429 } 436 430 437 431 function get_height() 438 432 { 439 preg_match('#^\d+x(\d+)(?:\+|$)#', $this->image_data['Geometry'], $match); 440 return isset($match[1]) ? $match[1] : false; 433 return $this->height; 441 434 } 442 435
Note: See TracChangeset
for help on using the changeset viewer.