Changeset 11081 for plugins/sfThumbnailPlugin
- Timestamp:
- 08/24/08 14:28:26 (5 years ago)
- Files:
-
- plugins/sfThumbnailPlugin/lib/sfImageMagickAdapter.class.php (modified) (4 diffs)
- plugins/sfThumbnailPlugin/package.xml (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfThumbnailPlugin/lib/sfImageMagickAdapter.class.php
r10909 r11081 170 170 } 171 171 172 public function toResource()173 {174 throw new Exception('The ImageMagick adapter does not support the toResource method.');175 }176 177 172 public function loadFile($thumbnail, $image) 178 173 { … … 229 224 $height = $this->sourceHeight; 230 225 $x = $y = 0; 231 switch (@$this->options['method']) { 226 switch (@$this->options['method']) 227 { 232 228 case "shave_all": 233 if ($width > $height) 234 { 235 $x = ceil(($width - $height) / 2 ); 236 $width = $height; 237 } 238 elseif ($height > $width) 239 { 240 $y = ceil(($height - $width) / 2); 241 $height = $width; 229 $proportion['source'] = $width / $height; 230 $proportion['thumb'] = $thumbnail->getThumbWidth() / $thumbnail->getThumbHeight(); 231 232 if ($proportion['source'] > 1 && $proportion['thumb'] < 1) 233 { 234 $x = ($width - $height * $proportion['thumb']) / 2; 235 } 236 else 237 { 238 if ($proportion['source'] > $proportion['thumb']) 239 { 240 $x = ($width - $height * $proportion['thumb']) / 2; 241 } 242 else 243 { 244 $y = ($height - $width / $proportion['thumb']) / 2; 245 } 242 246 } 243 247 244 248 $command = sprintf(" -shave %dx%d", $x, $y); 245 249 break; 250 246 251 case "shave_bottom": 247 252 if ($width > $height) … … 282 287 283 288 break; 289 case 'custom': 290 $coords = $this->options['coords']; 291 if (empty($coords)) break; 292 293 $x = $coords['x1']; 294 $y = $coords['y1']; 295 $width = $coords['x2'] - $coords['x1']; 296 $height = $coords['y2'] - $coords['y1']; 297 298 if (is_null($thumbDest)) 299 { 300 $command = sprintf( 301 " -crop %dx%d+%d+%d %s '-' | %s", 302 $width, $height, 303 $x, $y, 304 escapeshellarg($this->image), 305 $this->magickCommands['convert'] 306 ); 307 308 $this->image = '-'; 309 } 310 else 311 { 312 $command = sprintf( 313 " -crop %dx%d+%d+%d %s %s && %s", 314 $width, $height, 315 $x, $y, 316 escapeshellarg($this->image), escapeshellarg($thumbDest), 317 $this->magickCommands['convert'] 318 ); 319 320 $this->image = $thumbDest; 321 } 322 break; 284 323 } // end switch 285 324 … … 293 332 } 294 333 295 if ($this->quality && $t argetMime== 'image/jpeg')334 if ($this->quality && $thumbnail->getMime() == 'image/jpeg') 296 335 { 297 336 $command .= ' -quality '.$this->quality.'% '; plugins/sfThumbnailPlugin/package.xml
r7941 r11081 11 11 <active>yes</active> 12 12 </lead> 13 <date>2008-0 3-17</date>13 <date>2008-08-23</date> 14 14 <time>22:10:00</time> 15 15 <version> 16 <release>1.5. 1</release>16 <release>1.5.3</release> 17 17 <api>1.0.0</api> 18 18 </version> … … 27 27 <file md5sum="ade44239bce430f61f7c0c8cd1ce89b0" name="lib/sfThumbnail.class.php" role="data" /> 28 28 <file md5sum="ea7aec8b4be6212af8434f65efa85a69" name="lib/sfGDAdapter.class.php" role="data" /> 29 <file md5sum="add9e55ed76cc8d607b11bf2a4704aea" name="lib/sfImageMagickAdapter.class.php" role="data" /> 30 <file md5sum="83736fac123e0add1a22078df8fa8541" name="lib/helper/sfThumbnailHelper.php" role="data" /> 29 <file md5sum="ce521588909d175f90f116e9a9500935" name="lib/sfImageMagickAdapter.class.php" role="data" /> 31 30 <file md5sum="c5de5dccc5785beae22f92424d51cad6" name="README" role="data" /> 32 31 <file md5sum="c0ab88a4687e9ff8e0fb6c95ca49ed74" name="LICENSE" role="data" />