You are here

public function ImageStyleInterface::transformDimensions in Drupal 9

Same name and namespace in other branches
  1. 8 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\image

Code

public function transformDimensions(array &$dimensions, $uri);