diff --git a/core/modules/editor/src/Form/EditorImageDialog.php b/core/modules/editor/src/Form/EditorImageDialog.php
index dcacf64..bb2d569 100644
--- a/core/modules/editor/src/Form/EditorImageDialog.php
+++ b/core/modules/editor/src/Form/EditorImageDialog.php
@@ -90,8 +90,8 @@ 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_dimensions = $image_upload['max_dimensions']['width'] . 'x' . $image_upload['max_dimensions']['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..c53b06f
--- /dev/null
+++ b/core/modules/editor/src/Tests/EditorUploadImageRescaleTest.php
@@ -0,0 +1,164 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\editor\Tests\EditorUploadImageRescaleTest.
+ */
+
+namespace Drupal\editor\Tests;
+
+use Drupal\editor\Entity\Editor;
+use Drupal\filter\Entity\FilterFormat;
+use Drupal\simpletest\WebTestBase;
+
+/**
+ * Test for image rescale function for Editor inline image.
+ *
+ * @group editor
+ */
+class EditorUploadImageRescaleTest extends WebTestBase {
+
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = ['editor', 'editor_test'];
+
+  /**
+   * A user with permission as administer for testing.
+   *
+   * @var \Drupal\user\Entity\User
+   */
+  protected $adminUser;
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUp() {
+    parent::setUp();
+
+    // Add text format.
+    FilterFormat::create([
+      'format' => 'basic_html',
+      'name' => 'Basic HTML',
+      'weight' => 0,
+    ])->save();
+
+    // Set up text editor.
+    Editor::create([
+      'format' => 'basic_html',
+      'editor' => 'unicorn',
+      'image_upload' => [
+        'status' => TRUE,
+        'scheme' => file_default_scheme(),
+        'directory' => 'inline-images',
+        'max_size' => '',
+        'max_dimensions' => [
+          'width' => '',
+          'height' => ''
+        ],
+      ]
+    ])->save();
+
+    // Create admin user.
+    $this->adminUser = $this->drupalCreateUser(['administer filters', 'use text format basic_html']);
+    $this->drupalLogin($this->adminUser);
+  }
+
+  /**
+   * Tests rescale of inline image.
+   */
+  public function testEditorUploadImageRescale() {
+    // Generate testing images.
+    $testing_image_list = $this->drupalGetTestFiles('image');
+
+    // Case 1: Editor "image_upload" has no "max_dimensions" set. The uploaded
+    // image should not rescale.
+    $test_image = $testing_image_list[0];
+    list($image_file_width, $image_file_height, $image_basename) = $this->getTestImageInfo($test_image);
+    $max_width = '';
+    $max_height = '';
+    $this->setMaxDimensions($max_width, $max_height);
+    $this->drupalGet('editor/dialog/image/basic_html/');
+    $edit = [];
+    $edit['files[fid]'] = drupal_realpath($test_image->uri);
+    $this->drupalPostForm('editor/dialog/image/basic_html/', $edit, t('Upload'));
+    list($uploaded_image_file_width, $uploaded_image_file_height) = $this->getUploadedImageDimensions($image_basename);
+    $same_dimensions = ($uploaded_image_file_width === $image_file_width) && ($uploaded_image_file_height === $image_file_height);
+    $this->assertTrue($same_dimensions, 'Uploaded image had the same dimensions');
+
+    // Case 2: Editor "image_upload" has "max_dimensions" with both width and
+    // height being lower than the uploaded image. The uploaded image should
+    // rescale.
+    $test_image = $testing_image_list[1];
+    list($image_file_width, $image_file_height, $image_basename) = $this->getTestImageInfo($test_image);
+    $max_width = $image_file_width - 5;
+    $max_height = $image_file_height - 5;
+    $this->setMaxDimensions($max_width, $max_height);
+    $this->drupalGet('editor/dialog/image/basic_html/');
+
+    //Upload the image
+    $edit = [];
+    $edit['files[fid]'] = drupal_realpath($test_image->uri);
+    $this->drupalPostForm('editor/dialog/image/basic_html/', $edit, t('Upload'));
+
+    //Check result: Image dimension would be the same.
+    list($uploaded_image_file_width, $uploaded_image_file_height) = $this->getUploadedImageDimensions($image_basename);
+    $rescale_result = ($uploaded_image_file_width <= $max_width) && ($uploaded_image_file_height <= $max_height);
+    $this->assertTrue($rescale_result, 'Uploaded image had been scaled');
+    $this->assertRaw(t('The image was resized to fit within the maximum allowed dimensions of %dimensions pixels.', ['%dimensions' => $max_width . 'x' . $max_height]));
+
+    // Case 3: Editor "image_upload" has "max_dimensions" with both width and
+    // height being higher than the uploaded image. The uploaded image should
+    // not rescale.
+    $test_image = $testing_image_list[2];
+    list($image_file_width, $image_file_height, $image_basename) = $this->getTestImageInfo($test_image);
+    $max_width = $image_file_width + 5;
+    $max_height = $image_file_height + 5;
+    $this->setMaxDimensions($max_width, $max_height);
+    $this->drupalGet('editor/dialog/image/basic_html/');
+    $edit = [];
+    $edit['files[fid]'] = drupal_realpath($test_image->uri);
+    $this->drupalPostForm('editor/dialog/image/basic_html/', $edit, t('Upload'));
+    list($uploaded_image_file_width, $uploaded_image_file_height) = $this->getUploadedImageDimensions($image_basename);
+    $same_dimensions = ($uploaded_image_file_width == $image_file_width) && ($uploaded_image_file_height == $image_file_height);
+    $this->assertTrue($same_dimensions, 'Uploaded image had the same dimensions');
+  }
+
+  protected function getTestImageInfo($image) {
+    $image_factory = $this->container->get('image.factory');
+    $image_file = $image_factory->get($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'];
+    return [
+      $image_file_width,
+      $image_file_height,
+      $image_basename,
+    ];
+  }
+
+  protected function getUploadedImageDimensions($image_basename) {
+    $image_factory = $this->container->get('image.factory');
+    $uploaded_image_url = 'public://inline-images/' . $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();
+    return [
+        $uploaded_image_file_width,
+        $uploaded_image_file_height,
+    ];
+  }
+
+  protected function setMaxDimensions($width, $height) {
+    $editor = Editor::load('basic_html');
+    $image_upload_settings = $editor->getImageUploadSettings();
+    $image_upload_settings['max_dimensions']['width'] = $width;
+    $image_upload_settings['max_dimensions']['height'] = $height;
+    $editor->setImageUploadSettings($image_upload_settings);
+    $editor->save();
+  }
+
+}
