/** * {@inheritdoc} */ public function applyEffect(ImageInterface $image) { if (!$image->resize($this->configuration['width'], $this->configuration['height'])) { $this->logger->error('Image resize failed using the %toolkit toolkit on %path (%mimetype, %dimensions)', array('%toolkit' => $image->getToolkitId(), '%path' => $image->getSource(), '%mimetype' => $image->getMimeType(), '%dimensions' => $image->getWidth() . 'x' . $image->getHeight())); return FALSE; } return TRUE; }
/** * {@inheritdoc} */ public function applyEffect(ImageInterface $image) { // First, attempt to resize the image. $resize_data = self::calculateResizeData($image->getWidth(), $image->getHeight(), $this->configuration['width'], $this->configuration['height']); if (!$image->resize($resize_data['width'], $resize_data['height'])) { watchdog('image', 'Focal point scale and crop failed while resizing using the %toolkit toolkit on %path (%mimetype, %dimensions)', array('%toolkit' => $image->getToolkitId(), '%path' => $image->getSource(), '%mimetype' => $image->getMimeType(), '%dimensions' => $image->getWidth() . 'x' . $image->getHeight()), WATCHDOG_ERROR); return FALSE; } // Next, attempt to crop the image. $focal_point = FocalPoint::getFromURI($image->getSource()); $crop_data = self::calculateCropData($focal_point, $image->getWidth(), $image->getHeight(), $this->configuration['width'], $this->configuration['height']); if (!$image->crop($crop_data['x'], $crop_data['y'], $crop_data['width'], $crop_data['height'])) { watchdog('image', 'Focal point scale and crop failed while scaling and cropping using the %toolkit toolkit on %path (%mimetype, %dimensions)', array('%toolkit' => $image->getToolkitId(), '%path' => $image->getSource(), '%mimetype' => $image->getMimeType(), '%dimensions' => $image->getWidth() . 'x' . $image->getHeight()), WATCHDOG_ERROR); return FALSE; } return TRUE; }
/** * {@inheritdoc} */ public function applyEffect(ImageInterface $image) { $dimensions = $this->getUriDependentDimensions($image->getSource()); return $image->resize($dimensions['width'], $dimensions['height']); }