Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function applyEffect(ImageInterface $image)
 {
     $data = [];
     $data['canvas_color'] = $this->configuration['canvas_color'];
     // Get resulting dimensions.
     $dimensions = $this->getDimensions($image->getWidth(), $image->getHeight());
     $data['width'] = $dimensions['width'];
     $data['height'] = $dimensions['height'];
     // Get offset of original image.
     if ($this->configuration['canvas_size'] === 'exact') {
         list($x_pos, $y_pos) = explode('-', $this->configuration['exact']['placement']);
         $data['x_pos'] = image_filter_keyword($x_pos, $data['width'], $image->getWidth()) + $this->configuration['exact']['x_offset'];
         $data['y_pos'] = image_filter_keyword($y_pos, $data['height'], $image->getHeight()) + $this->configuration['exact']['y_offset'];
     } else {
         $data['x_pos'] = $this->configuration['relative']['left'];
         $data['y_pos'] = $this->configuration['relative']['top'];
     }
     // All the math is done, now defer to the toolkit in use.
     return $image->apply('set_canvas', $data);
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function applyEffect(ImageInterface $image)
 {
     return $image->apply('contrast', ['level' => $this->configuration['level']]);
 }
Ejemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function applyEffect(ImageInterface $image)
 {
     $watermark_image = $this->imageFactory->get($this->configuration['watermark_image']);
     if (!$watermark_image->isValid()) {
         return FALSE;
     }
     list($x, $y) = explode('-', $this->configuration['placement']);
     $x_pos = image_filter_keyword($x, $image->getWidth(), $watermark_image->getWidth());
     $y_pos = image_filter_keyword($y, $image->getHeight(), $watermark_image->getHeight());
     return $image->apply('watermark', ['x_offset' => $x_pos + $this->configuration['x_offset'], 'y_offset' => $y_pos + $this->configuration['y_offset'], 'opacity' => $this->configuration['opacity'], 'watermark_image' => $watermark_image]);
 }
Ejemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 public function applyEffect(ImageInterface $image)
 {
     return $image->apply('colorshift', ['RGB' => $this->configuration['RGB']]);
 }
 /**
  * {@inheritdoc}
  */
 public function applyEffect(ImageInterface $image)
 {
     return $image->apply('strip');
 }
Ejemplo n.º 6
0
 /**
  * {@inheritdoc}
  */
 public function applyEffect(ImageInterface $image)
 {
     // Test to see if EXIF is supported by the image format.
     if (in_array($image->getMimeType(), ['image/jpeg', 'image/tiff'])) {
         // Hand over to toolkit.
         return $image->apply('auto_orient');
     }
     return TRUE;
 }