Changeset 11650 for extensions/external_ImageMagick
- Timestamp:
- Jul 6, 2011, 5:48:09 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/external_ImageMagick/trunk/imagick.class.php
r9860 r11650 7 7 var $imagemagickdir = ''; 8 8 var $commands = array(); 9 var $width = ''; 10 var $height = ''; 9 11 10 12 const INTERLACE_NO = 'none'; … … 50 52 $this->imagemagickdir = rtrim($conf['imagick_dir'], ' /\\').'/'; 51 53 52 $command = $this->imagemagickdir. "identify -verbose ".realpath($this->source_path);54 $command = $this->imagemagickdir.'identify -format "%wx%h" "'.realpath($this->source_path).'"'; 53 55 @exec($command, $returnarray, $returnvalue); 54 if($returnvalue )56 if($returnvalue or !preg_match('/^(\d+)x(\d+)$/', $returnarray[0], $match)) 55 57 { 56 die(" ImageMagick:Corrupt image");58 die("[External ImageMagick] Corrupt image"); 57 59 } 58 else 59 { 60 foreach($returnarray as $value) 61 { 62 $arr = explode(':', $value, 2); 63 if (count($arr) == 2) 64 { 65 $this->image_data[trim($arr[0])] = trim($arr[1]); 66 } 67 } 68 } 60 61 $this->width = $match[1]; 62 $this->height = $match[2]; 69 63 } 70 64 … … 76 70 function getImageWidth() 77 71 { 78 preg_match('#^(\d+)x#', $this->image_data['Geometry'], $match); 79 return isset($match[1]) ? $match[1] : false; 72 return $this->width; 80 73 } 81 74 82 75 function getImageHeight() 83 76 { 84 preg_match('#^\d+x(\d+)(?:\+|$)#', $this->image_data['Geometry'], $match); 85 return isset($match[1]) ? $match[1] : false; 77 return $this->height; 86 78 } 87 79 … … 128 120 129 121 $exec = $this->imagemagickdir.'convert'; 130 $exec .= ' '.realpath($this->source_path);122 $exec .= ' "'.realpath($this->source_path).'"'; 131 123 132 124 foreach ($this->commands as $command => $params) … … 140 132 141 133 $dest = pathinfo($destination_filepath); 142 $exec .= ' '.realpath($dest['dirname']).'/'.$dest['basename'];134 $exec .= ' "'.realpath($dest['dirname']).'/'.$dest['basename'].'"'; 143 135 @exec($exec, $returnarray, $returnvalue); 144 136 }
Note: See TracChangeset
for help on using the changeset viewer.