From 40751559e7c3189f448ea3baafed2cc50c8d4f3c Mon Sep 17 00:00:00 2001
From: Claudiu Cristea <clau.cristea@gmail.com>
Date: Mon, 12 Aug 2013 18:39:38 +0300
Subject: [PATCH] Issue #2063373 by claudiu.cristea: Fixed Image created from
 resource won't save.

---
 .../lib/Drupal/image/Tests/ImageEffectsTest.php      | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageEffectsTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageEffectsTest.php
index 74f41ec..247dac3 100644
--- a/core/modules/image/lib/Drupal/image/Tests/ImageEffectsTest.php
+++ b/core/modules/image/lib/Drupal/image/Tests/ImageEffectsTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\image\Tests;
 
+use Drupal\Core\Image\Image;
 use Drupal\system\Tests\Image\ToolkitTestBase;
 
 /**
@@ -177,4 +178,23 @@ protected function assertImageEffect($effect_name, array $data) {
     return $this->assertTrue($effect->applyEffect($this->image), 'Function returned the expected value.');
   }
 
+  /**
+   * Test image save for an image created from resource.
+   */
+  public function testImageSave() {
+    $destination =  'public://' . $this->randomName() . '.png';
+
+    $res = imagecreatetruecolor(20, 20);
+
+    $image = new Image($destination, \Drupal::service('image.toolkit'));
+
+    $this->assertTrue($image
+      ->setResource($res)
+      ->setWidth(20)
+      ->setHeight(20)
+      ->save());
+
+    $this->assertTrue(file_exists($destination));
+  }
+
 }
-- 
1.8.3.1

