diff --git a/core/modules/editor/src/Form/EditorImageDialog.php b/core/modules/editor/src/Form/EditorImageDialog.php
index dcacf64..d08692f 100644
--- a/core/modules/editor/src/Form/EditorImageDialog.php
+++ b/core/modules/editor/src/Form/EditorImageDialog.php
@@ -90,9 +90,10 @@ public function buildForm(array $form, FormStateInterface $form_state, FilterFor
 
     // Construct strings to use in the upload validators.
     $image_upload = $editor->getImageUploadSettings();
-    if (!empty($image_upload['dimensions'])) {
-      $max_dimensions = $image_upload['dimensions']['max_width'] . '×' . $image_upload['dimensions']['max_height'];
-    }
+    if (!empty($image_upload['max_dimensions']['width']) && !empty($image_upload['max_dimensions']['height']) ) {
+      $max_width = (string) $image_upload['max_dimensions']['width'];
+      $max_height = (string) $image_upload['max_dimensions']['height'];
+      $max_dimensions = $max_width . 'x' . $max_height;
     else {
       $max_dimensions = 0;
     }
diff --git a/core/modules/editor/src/Tests/EditorUploadImageRescaleTest.php b/core/modules/editor/src/Tests/EditorUploadImageRescaleTest.php
new file mode 100644
index 0000000..1fa08ff
--- /dev/null
+++ b/core/modules/editor/src/Tests/EditorUploadImageRescaleTest.php
@@ -0,0 +1,205 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\editor\Tests\EditorUploadImageRescaleTest.
+ */
+
+namespace Drupal\editor\Tests;
+
+use Drupal\simpletest\WebTestBase;
+
+/**
+ * Test for image rescale function for Editor inline image.
+ *
+ * @group editor
+ */
+class EditorUploadImageRescaleTest extends WebTestBase {
+
+  protected $profile = 'standard';
+
+  protected $adminUser;
+
+  protected function setUp() {
+
+    parent::setUp();
+    $this->adminUser = $this->drupalCreateUser(array('administer filters'));
+    $this->drupalLogin($this->adminUser);
+
+  }
+
+
+  function testEditorUploadImageRescale() {
+
+    //Generate Testing images
+    $testing_image_list = $this->drupalGetTestFiles('image');
+
+
+    //Case 1 - Test for No restruction on maximum dimensions
+    //         Expected Result: Image uploaded without rescale
+
+    //Get the image information from image list
+    $test_image = $testing_image_list[0];
+    $image_factory = $this->container->get('image.factory');
+    $image_file = $image_factory->get($test_image->uri);
+    $image_file_width = (int) $image_file->getWidth();
+    $image_file_height = (int) $image_file->getHeight();
+    $path_parts = pathinfo($image_file->getSource());
+    $image_basename = $path_parts['basename'];
+
+    //Setup the editor without maximum dimensions
+    $max_width = '';
+    $max_height = '';
+    $editor = entity_load('editor', 'basic_html');
+    $image_upload_settings = $editor->getImageUploadSettings();
+    $image_upload_settings['max_dimensions']['width'] = $max_width;
+    $image_upload_settings['max_dimensions']['height'] = $max_height;
+    $editor->setImageUploadSettings($image_upload_settings);
+    $editor->save();
+
+    //Access the editor image dialog form
+    $this->drupalGet('editor/dialog/image/basic_html/');
+    $this->assertResponse(200);
+    $this->assertUrl('editor/dialog/image/basic_html/');
+
+    //Upload image
+    $edit = array();
+    $edit['files[fid]'] = drupal_realpath($test_image->uri);
+    $this->drupalPostForm('editor/dialog/image/basic_html/', $edit, t('Upload'));
+
+
+    //Check result: Upload process complete if 'remove' button show.
+    $this->assertRaw(t('Remove'));
+
+    //Check result: Image dimension would be the same
+    $uploaded_image_url = $image_upload_settings['scheme'] . '://' . $image_upload_settings['directory'] . '/' . $image_basename;
+    $uploaded_image_file = $image_factory->get($uploaded_image_url);
+    $uploaded_image_file_width = (int) $uploaded_image_file->getWidth();
+    $uploaded_image_file_height = (int) $uploaded_image_file->getHeight();
+
+    if (($uploaded_image_file_width == $image_file_width) && ($uploaded_image_file_height == $image_file_height))
+    {
+      $same_dimensions = TRUE;
+    }
+    else
+    {
+      $same_dimensions = FALSE;
+    }
+    $this->assertTrue($same_dimensions, 'Uploaded image had the same dimensions');
+
+
+    //Case 2 - Test for image rescale when the dimension larger than maximum dimensions
+    //         Expected : Image uploaded with rescale
+
+   //Get the image information from image list
+    $test_image = $testing_image_list[1];
+    $image_factory = $this->container->get('image.factory');
+    $image_file = $image_factory->get($test_image->uri);
+    $image_file_width = (int) $image_file->getWidth();
+    $image_file_height = (int) $image_file->getHeight();
+    $path_parts = pathinfo($image_file->getSource());
+    $image_basename = $path_parts['basename'];
+
+
+    //Setup the editor with maximum dimensions just below the testing image
+    $max_width = $image_file_width - 5;
+    $max_height = $image_file_height - 5;
+    $editor = entity_load('editor', 'basic_html');
+    $image_upload_settings = $editor->getImageUploadSettings();
+    $image_upload_settings['max_dimensions']['width'] = $max_width;
+    $image_upload_settings['max_dimensions']['height'] = $max_height;
+    $editor->setImageUploadSettings($image_upload_settings);
+    $editor->save();
+
+
+    //Access the editor dialog form
+    $this->drupalGet('editor/dialog/image/basic_html/');
+    $this->assertResponse(200);
+    $this->assertUrl('editor/dialog/image/basic_html/');
+
+    //Upload the image
+    $edit = array();
+    $edit['files[fid]'] = drupal_realpath($test_image->uri);
+    $this->drupalPostForm('editor/dialog/image/basic_html/', $edit, t('Upload'));
+
+
+    //Check result: Upload process complete if 'remove' button show.
+    $this->assertRaw(t('Remove'));
+
+    //Check result: Image dimension would be the same
+    $uploaded_image_url = $image_upload_settings['scheme'] . '://' . $image_upload_settings['directory'] . '/' . $image_basename;
+    $uploaded_image_file = $image_factory->get($uploaded_image_url);
+    $uploaded_image_file_width = (int) $uploaded_image_file->getWidth();
+    $uploaded_image_file_height = (int) $uploaded_image_file->getHeight();
+    if (($uploaded_image_file_width <= $max_width) && ($uploaded_image_file_height <= $max_height))
+    {
+      $rescale_result = TRUE;
+    }
+    else
+    {
+      $rescale_result = FALSE;
+    }
+    $this->assertTrue($rescale_result, 'Uploaded image had been scaled');
+
+    //Check result: rescale message had shown
+    $this->assertRaw(t('The image was resized to fit within the maximum allowed dimensions of %dimensions pixels.', array('%dimensions' => $max_width . 'x' . $max_height)));
+
+
+    //Case 3 - Test for having restruction on maximum dimensions but image scale is below the restruction
+    //         Expected Result: Image uploaded without rescale
+
+   //Get the image information from image list
+    $test_image = $testing_image_list[2];
+    $image_factory = $this->container->get('image.factory');
+    $image_file = $image_factory->get($test_image->uri);
+
+    $image_file_width = (int) $image_file->getWidth();
+    $image_file_height = (int) $image_file->getHeight();
+    $path_parts = pathinfo($image_file->getSource());
+    $image_basename = $path_parts['basename'];
+
+
+    //Setup the editor maximum dimensions value higher than image resolution
+    $max_width = $image_file_width + 5;
+    $max_height = $image_file_height + 5;
+    $editor = entity_load('editor', 'basic_html');
+    $image_upload_settings = $editor->getImageUploadSettings();
+    $image_upload_settings['max_dimensions']['width'] = $max_width;
+    $image_upload_settings['max_dimensions']['height'] = $max_height;
+    $editor->setImageUploadSettings($image_upload_settings);
+    $editor->save();
+
+
+    //Access the editor image dialog form
+    $this->drupalGet('editor/dialog/image/basic_html/');
+    $this->assertResponse(200);
+    $this->assertUrl('editor/dialog/image/basic_html/');
+
+    //Upload image
+    $edit = array();
+    $edit['files[fid]'] = drupal_realpath($test_image->uri);
+    $this->drupalPostForm('editor/dialog/image/basic_html/', $edit, t('Upload'));
+
+
+    //Check result: Upload process complete if 'remove' button show.
+    $this->assertRaw(t('Remove'));
+
+    //Check result: Image dimension would be the same
+    $uploaded_image_url = $image_upload_settings['scheme'] . '://' . $image_upload_settings['directory'] . '/' . $image_basename;
+    $uploaded_image_file = $image_factory->get($uploaded_image_url);
+    $uploaded_image_file_width = (int) $uploaded_image_file->getWidth();
+    $uploaded_image_file_height = (int) $uploaded_image_file->getHeight();
+
+    if (($uploaded_image_file_width == $image_file_width) && ($uploaded_image_file_height == $image_file_height))
+    {
+      $same_dimensions = TRUE;
+    }
+    else
+    {
+      $same_dimensions = FALSE;
+    }
+    $this->assertTrue($same_dimensions, 'Uploaded image had the same dimensions');
+
+  }
+
+}
