class AutoOrient in Image Effects 8.2
Same name in this branch
- 8.2 src/Plugin/ImageToolkit/Operation/gd/AutoOrient.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\gd\AutoOrient
- 8.2 src/Plugin/ImageToolkit/Operation/imagemagick/AutoOrient.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\imagemagick\AutoOrient
Same name and namespace in other branches
- 8.3 src/Plugin/ImageToolkit/Operation/imagemagick/AutoOrient.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\imagemagick\AutoOrient
- 8 src/Plugin/ImageToolkit/Operation/imagemagick/AutoOrient.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\imagemagick\AutoOrient
Defines ImageMagick AutoOrient operation.
Plugin annotation
@ImageToolkitOperation(
id = "image_effects_imagemagick_auto_orient",
toolkit = "imagemagick",
operation = "auto_orient",
label = @Translation("Auto orient image"),
description = @Translation("Automatically adjusts the orientation of an image.")
)
Hierarchy
- class \Drupal\image_effects\Plugin\ImageToolkit\Operation\imagemagick\AutoOrient extends \Drupal\imagemagick\Plugin\ImageToolkit\Operation\imagemagick\ImagemagickImageToolkitOperationBase
Expanded class hierarchy of AutoOrient
File
- src/
Plugin/ ImageToolkit/ Operation/ imagemagick/ AutoOrient.php, line 18
Namespace
Drupal\image_effects\Plugin\ImageToolkit\Operation\imagemagickView source
class AutoOrient extends ImagemagickImageToolkitOperationBase {
/**
* {@inheritdoc}
*/
protected function arguments() {
// This operation does not use any parameters.
return [];
}
/**
* {@inheritdoc}
*/
protected function execute(array $arguments) {
$this
->addArgument('-auto-orient');
// Swap toolkit's height and width when picture orientation is vertical.
if (in_array($this
->getToolkit()
->getExifOrientation(), [
5,
6,
7,
8,
])) {
$tmp = $this
->getToolkit()
->getWidth();
$this
->getToolkit()
->setWidth($this
->getToolkit()
->getHeight());
$this
->getToolkit()
->setHeight($tmp);
$this
->getToolkit()
->setExifOrientation(NULL);
}
return TRUE;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AutoOrient:: |
protected | function | ||
AutoOrient:: |
protected | function |