getUriDependentDimensions example


class UriDependentTestImageEffect extends ImageEffectBase {

  /** * {@inheritdoc} */
  public function transformDimensions(array &$dimensions$uri) {
    $dimensions = $this->getUriDependentDimensions($uri);
  }

  /** * {@inheritdoc} */
  public function applyEffect(ImageInterface $image) {
    $dimensions = $this->getUriDependentDimensions($image->getSource());
    return $image->resize($dimensions['width']$dimensions['height']);
  }

  /** * Make the image dimensions dependent on the image file extension. * * @param string $uri * Original image file URI. * * @return array * Associative array. * - width: Integer with the derivative image width. * - height: Integer with the derivative image height. */
Home | Imprint | This part of the site doesn't use cookies.