diff --git a/core/lib/Drupal/Core/Image/Image.php b/core/lib/Drupal/Core/Image/Image.php index f7248c2..75dad44 100644 --- a/core/lib/Drupal/Core/Image/Image.php +++ b/core/lib/Drupal/Core/Image/Image.php @@ -225,6 +225,13 @@ public function getToolkitId() { /** * {@inheritdoc} */ + public function toolkitProcess($operation, array $data = array()) { + return $this->toolkit->process($operation, $this, $data); + } + + /** + * {@inheritdoc} + */ public function save($destination = NULL) { if (empty($destination)) { $destination = $this->getSource(); @@ -326,7 +333,7 @@ public function crop($x, $y, $width, $height) { $width = (int) round($width); $height = (int) round($height); - return $this->toolkit->process('crop', $this, array('x' => $x, 'y' => $y, 'width' => $width, 'height' => $height)); + return $this->toolkitProcess('crop', array('x' => $x, 'y' => $y, 'width' => $width, 'height' => $height)); } /** @@ -336,21 +343,21 @@ public function resize($width, $height) { $width = (int) round($width); $height = (int) round($height); - return $this->toolkit->process('resize', $this, array('width' => $width, 'height' => $height)); + return $this->toolkitProcess('resize', array('width' => $width, 'height' => $height)); } /** * {@inheritdoc} */ public function desaturate() { - return $this->toolkit->process('desaturate', $this); + return $this->toolkitProcess('desaturate'); } /** * {@inheritdoc} */ public function rotate($degrees, $background = NULL) { - return $this->toolkit->process('rotate', $this, array('degrees' => $degrees, 'background' => $background)); + return $this->toolkitProcess('rotate', array('degrees' => $degrees, 'background' => $background)); } /** diff --git a/core/lib/Drupal/Core/Image/ImageInterface.php b/core/lib/Drupal/Core/Image/ImageInterface.php index 5966ab2..12aea9f 100644 --- a/core/lib/Drupal/Core/Image/ImageInterface.php +++ b/core/lib/Drupal/Core/Image/ImageInterface.php @@ -144,6 +144,19 @@ public function getSource(); public function getToolkitId(); /** + * Performs an image toolkit operation. + * + * @param string $operation + * The toolkit operation to be processed. + * @param array $data + * An array of variables to be used by the toolkit operation. + * + * @return mixed + * The value returned by the image toolkit operation. + */ + public function toolkitProcess($operation, array $data = array()); + + /** * Closes the image and saves the changes to a file. * * @param string|null $destination