You are here

public function ImageOverlayEffect::applyEffect in Image effect kit 8

Applies an image effect to the image object.

Parameters

\Drupal\Core\Image\ImageInterface $image: An image file object.

Return value

bool TRUE on success. FALSE if unable to perform the image effect on the image.

Overrides ImageEffectInterface::applyEffect

File

src/Plugin/ImageEffect/ImageOverlayEffect.php, line 28
Contains \Drupal\iek\Plugin\ImageEffect\ImageOverlayEffect.

Class

ImageOverlayEffect
IEK - Overlay.

Namespace

Drupal\iek\Plugin\ImageEffect

Code

public function applyEffect(ImageInterface $image) {
  if (!$image
    ->apply('iek_image_overlay', $this->configuration)) {
    $this->logger
      ->error('IEK - Overlay failed using the %toolkit toolkit on %path (%mimetype, %dimensions)', [
      '%toolkit' => $image
        ->getToolkitId(),
      '%path' => $image
        ->getSource(),
      '%mimetype' => $image
        ->getMimeType(),
      '%dimensions' => $image
        ->getWidth() . 'x' . $image
        ->getHeight(),
    ]);
    return FALSE;
  }
  return TRUE;
}