public function ImageEffectBase::transformDimensions in Drupal 9
Same name and namespace in other branches
- 8 core/modules/image/src/ImageEffectBase.php \Drupal\image\ImageEffectBase::transformDimensions()
Determines the dimensions of the styled image.
Parameters
array &$dimensions: Dimensions to be modified - an array with the following keys:
- width: the width in pixels, or NULL if unknown
- height: the height in pixels, or NULL if unknown
When either of the dimensions are NULL, the corresponding HTML attribute will be omitted when an image style using this image effect is used.
string $uri: Original image file URI. It is passed in to allow an effect to optionally use this information to retrieve additional image metadata to determine dimensions of the styled image. ImageEffectInterface::transformDimensions key objective is to calculate styled image dimensions without performing actual image operations, so be aware that performing IO on the URI may lead to decrease in performance.
Overrides ImageEffectInterface::transformDimensions
4 methods override ImageEffectBase::transformDimensions()
- NullTestImageEffect::transformDimensions in core/
modules/ image/ tests/ modules/ image_module_test/ src/ Plugin/ ImageEffect/ NullTestImageEffect.php - Determines the dimensions of the styled image.
- ResizeImageEffect::transformDimensions in core/
modules/ image/ src/ Plugin/ ImageEffect/ ResizeImageEffect.php - Determines the dimensions of the styled image.
- RotateImageEffect::transformDimensions in core/
modules/ image/ src/ Plugin/ ImageEffect/ RotateImageEffect.php - Determines the dimensions of the styled image.
- UriDependentTestImageEffect::transformDimensions in core/
modules/ image/ tests/ modules/ image_module_test/ src/ Plugin/ ImageEffect/ UriDependentTestImageEffect.php - Determines the dimensions of the styled image.
File
- core/
modules/ image/ src/ ImageEffectBase.php, line 68
Class
- ImageEffectBase
- Provides a base class for image effects.
Namespace
Drupal\imageCode
public function transformDimensions(array &$dimensions, $uri) {
// Most image effects will not change the dimensions. This base
// implementation represents this behavior. Override this method if your
// image effect does change the dimensions.
}