diff --git a/core/lib/Drupal/Core/Image/Image.php b/core/lib/Drupal/Core/Image/Image.php index 386053e..f5b89dc 100644 --- a/core/lib/Drupal/Core/Image/Image.php +++ b/core/lib/Drupal/Core/Image/Image.php @@ -77,8 +77,11 @@ class Image implements ImageInterface { * The image toolkit. */ public function __construct($source, ImageToolkitInterface $toolkit) { - $this->source = $source; $this->toolkit = $toolkit; + if ($source) { + $this->source = $source; + $this->processInfo(); + } } /** diff --git a/core/lib/Drupal/Core/Image/ImageFactory.php b/core/lib/Drupal/Core/Image/ImageFactory.php index a97067c..1c106b4 100644 --- a/core/lib/Drupal/Core/Image/ImageFactory.php +++ b/core/lib/Drupal/Core/Image/ImageFactory.php @@ -53,7 +53,7 @@ public function setToolkitId($toolkit_id) { } /** - * Gets an Image object from an image file. + * Constructs a new Image object from an image file. * * @param string $source * The path to an image file. diff --git a/core/lib/Drupal/Core/Image/ImageInterface.php b/core/lib/Drupal/Core/Image/ImageInterface.php index 9551a20..cd26f1d 100644 --- a/core/lib/Drupal/Core/Image/ImageInterface.php +++ b/core/lib/Drupal/Core/Image/ImageInterface.php @@ -125,4 +125,5 @@ public function getToolkitId(); * @see \Drupal\Core\ImageToolkit\ImageToolkitInterface::save() */ public function save($destination = NULL); + } diff --git a/core/tests/Drupal/Tests/Core/Image/ImageTest.php b/core/tests/Drupal/Tests/Core/Image/ImageTest.php index fe9c686..1457e1c 100644 --- a/core/tests/Drupal/Tests/Core/Image/ImageTest.php +++ b/core/tests/Drupal/Tests/Core/Image/ImageTest.php @@ -46,9 +46,6 @@ protected function setUp() { ->method('getPluginId') ->will($this->returnValue('gd')); - $this->toolkit->expects($this->any()) - ->method('getInfo'); - $this->image = new Image($this->source, $this->toolkit); }