You are here

protected function RetinaImageEffectTrait::multiplyDimension in Retina Images 8

Multiply a dimension by the specified resolution multiplier.

Only modifies input if effect has 'retinafy' option enabled.

Parameters

$dimension: The dimension to be altered.

null $multiplier: (optional) Multiplier to use. If not specified, here, the default from configuration will be used. If configuration is empty, default from self::$defaultMultiplier will be used.

Return value

int The new dimensions.

4 calls to RetinaImageEffectTrait::multiplyDimension()
RetinaCropImageEffect::applyEffect in src/Plugin/ImageEffect/RetinaCropImageEffect.php
Applies an image effect to the image object.
RetinaResizeImageEffect::applyEffect in src/Plugin/ImageEffect/RetinaResizeImageEffect.php
Applies an image effect to the image object.
RetinaScaleAndCropImageEffect::applyEffect in src/Plugin/ImageEffect/RetinaScaleAndCropImageEffect.php
Applies an image effect to the image object.
RetinaScaleImageEffect::applyEffect in src/Plugin/ImageEffect/RetinaScaleImageEffect.php
Applies an image effect to the image object.

File

src/RetinaImageEffectTrait.php, line 40
Provides shared helpers for all retina image effects.

Class

RetinaImageEffectTrait
Provides shared helpers for all retina image effects.

Namespace

Drupal\retina_images

Code

protected function multiplyDimension($dimension, $multiplier = NULL) {
  if ($this->configuration['retinafy']) {
    if (!$multiplier) {
      $multiplier = $this
        ->getMultiplier();
    }
    return (int) ($dimension * $multiplier);
  }
  else {
    return (int) $dimension;
  }
}