Drupal 8  8.0.2
Image Class Reference

Static Public Member Functions

static scaleDimensions (array &$dimensions, $width=NULL, $height=NULL, $upscale=FALSE)
 

Detailed Description

Provides helpers to operate on images.

Member Function Documentation

static scaleDimensions ( array &  $dimensions,
  $width = NULL,
  $height = NULL,
  $upscale = FALSE 
)
static

Scales image dimensions while maintaining aspect ratio.

The resulting dimensions can be smaller for one or both target dimensions.

Parameters
array$dimensionsDimensions to be modified - an array with components width and height, in pixels.
int$width(optional) The target width, in pixels. If this value is NULL then the scaling will be based only on the height value.
int$height(optional) The target height, in pixels. If this value is NULL then the scaling will be based only on the width value.
bool$upscale(optional) Boolean indicating that images smaller than the target dimensions will be scaled up. This generally results in a low quality image.
Returns
bool TRUE if $dimensions was modified, FALSE otherwise.
See Also
image_scale()

Referenced by ImageTest\testScaleDimensions(), and ScaleImageEffect\transformDimensions().

Here is the caller graph for this function:


The documentation for this class was generated from the following file: