You are here

public function ReflectImageEffect::applyEffect in ImageCache Reflect 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

lib/Drupal/imagecache_reflect/Plugin/ImageEffect/ReflectImageEffect.php, line 31
Contains \Drupal\imagecache_reflect\Plugin\ImageEffect\ReflectImageEffect.

Class

ReflectImageEffect
Creates a reflection-like effect on an image resource.

Namespace

Drupal\imagecache_reflect\Plugin\ImageEffect

Code

public function applyEffect(ImageInterface $image) {

  // Apply operation.
  // @todo: Convert this operation to a toolkit plugin.
  // @todo: Add support for imagemagick.
  if (!GDToolkitReflect::reflect($image, $this->configuration)) {
    watchdog('image', 'Image reflect failed using the %toolkit toolkit on %path (%mimetype, %configuration)', array(
      '%toolkit' => $image
        ->getToolkitId(),
      '%path' => $image
        ->getSource(),
      '%mimetype' => $image
        ->getMimeType(),
      '%configuration' => 'Size: ' . $this->configuration['size'] . ', Position: ' . $this->configuration['position'],
    ), WATCHDOG_ERROR);
    return FALSE;
  }
  return TRUE;
}