function ImageStyleInterface::transformDimensions
Same name in other branches
- 9 core/modules/image/src/ImageStyleInterface.php \Drupal\image\ImageStyleInterface::transformDimensions()
- 8.9.x core/modules/image/src/ImageStyleInterface.php \Drupal\image\ImageStyleInterface::transformDimensions()
- 10 core/modules/image/src/ImageStyleInterface.php \Drupal\image\ImageStyleInterface::transformDimensions()
Determines the dimensions of this image style.
Stores the dimensions of this image style into $dimensions associative array. Implementations have to provide at least values to next keys:
- width: Integer with the derivative image width.
- height: Integer with the derivative image height.
Parameters
array $dimensions: Associative array passed by reference. Implementations have to store the resulting width and height, in pixels.
string $uri: Original image file URI. It is passed in to allow effects to optionally use this information to retrieve additional image metadata to determine dimensions of the styled image. ImageStyleInterface::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.
See also
ImageEffectInterface::transformDimensions
1 method overrides ImageStyleInterface::transformDimensions()
- ImageStyle::transformDimensions in core/
modules/ image/ src/ Entity/ ImageStyle.php - Determines the dimensions of this image style.
File
-
core/
modules/ image/ src/ ImageStyleInterface.php, line 128
Class
- ImageStyleInterface
- Provides an interface defining an image style entity.
Namespace
Drupal\imageCode
public function transformDimensions(array &$dimensions, $uri);
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.