function RotateImageEffect::transformDimensions
Same name in other branches
- 9 core/modules/image/src/Plugin/ImageEffect/RotateImageEffect.php \Drupal\image\Plugin\ImageEffect\RotateImageEffect::transformDimensions()
- 8.9.x core/modules/image/src/Plugin/ImageEffect/RotateImageEffect.php \Drupal\image\Plugin\ImageEffect\RotateImageEffect::transformDimensions()
- 10 core/modules/image/src/Plugin/ImageEffect/RotateImageEffect.php \Drupal\image\Plugin\ImageEffect\RotateImageEffect::transformDimensions()
Overrides ImageEffectBase::transformDimensions
File
-
core/
modules/ image/ src/ Plugin/ ImageEffect/ RotateImageEffect.php, line 42
Class
- RotateImageEffect
- Rotates an image resource.
Namespace
Drupal\image\Plugin\ImageEffectCode
public function transformDimensions(array &$dimensions, $uri) {
// If the rotate is not random and current dimensions are set,
// then the new dimensions can be determined.
if (!$this->configuration['random'] && $dimensions['width'] && $dimensions['height']) {
$rect = new Rectangle($dimensions['width'], $dimensions['height']);
$rect = $rect->rotate($this->configuration['degrees']);
$dimensions['width'] = $rect->getBoundingWidth();
$dimensions['height'] = $rect->getBoundingHeight();
}
else {
$dimensions['width'] = $dimensions['height'] = NULL;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.