diff --git a/core/modules/editor/editor.module b/core/modules/editor/editor.module
index af2b8ea..bd0a642 100644
--- a/core/modules/editor/editor.module
+++ b/core/modules/editor/editor.module
@@ -236,6 +236,84 @@ function editor_form_filter_format_form_alter(&$form, &$form_state) {
     ),
   );
 
+  $form['editor']['settings']['upload_directory'] = array(
+      '#type' => 'textfield',
+      '#default_value' => isset($editor->settings['upload_directory']) ? $editor->settings['upload_directory'] : '',
+      '#title' => t('Upload directory'),
+      '#description' => t('A directory relative to Drupal\'s files directory where upload images will be stored.'),
+  );
+  
+  $form['editor']['settings']['upload_file_size'] = array(
+      '#type' => 'textfield',
+      '#default_value' => isset($editor->settings['upload_file_size']) ? $editor->settings['upload_file_size'] : '',
+      '#title' => t('Maximum image size'),
+      '#description' => t('If this is left empty, then the file size will be limited by the PHP maximum upload size of ' . format_size(file_upload_max_size())),
+  );  
+  
+  $form['editor']['settings']['upload_max_dimensions'] = array(
+      '#type' => 'item',
+      '#title' => t('Maximum image dimensions'),
+      '#field_prefix' => '<div class="container-inline clearfix">',
+      '#field_suffix' => '</div>',
+      '#description' => t('Images larger than these dimensions will be scaled down.'),
+  );
+  $form['editor']['settings']['upload_max_dimensions']['max_width'] = array(
+    '#title' => t('Width'),
+    '#title_display' => 'invisible',
+    '#type' => 'number',
+    '#default_value' => isset($editor->settings['upload_max_dimensions']['max_width']) ? $editor->settings['upload_max_dimensions']['max_width'] : '',
+    '#size' => 8,
+    '#maxlength' => 8,
+    '#min' => 1,
+    '#max' => 99999,
+    '#placeholder' => 'width',
+    '#field_suffix' => ' x ',
+  );
+  $form['editor']['settings']['upload_max_dimensions']['max_height'] = array(
+    '#title' => t('Height'),
+    '#title_display' => 'invisible',
+    '#type' => 'number',
+    '#default_value' => isset($editor->settings['upload_max_dimensions']['max_height']) ? $editor->settings['upload_max_dimensions']['max_height'] : '',
+    '#size' => 8,
+    '#maxlength' => 8,
+    '#min' => 1,
+    '#max' => 99999,
+    '#placeholder' => 'height',
+    '#field_suffix' => 'pixels',
+  );  
+
+  $form['editor']['settings']['upload_min_dimensions'] = array(
+    '#type' => 'item',
+    '#title' => t('Minimum image dimensions'),
+    '#field_prefix' => '<div class="container-inline clearfix">',
+    '#field_suffix' => '</div>',
+    '#description' => t('Images smaller than these dimensions will not be uploaded.'),
+  );
+  $form['editor']['settings']['upload_min_dimensions']['min_width'] = array(
+    '#title' => t('Width'),
+    '#title_display' => 'invisible',
+    '#type' => 'number',
+    '#default_value' => isset($editor->settings['upload_min_dimensions']['min_width']) ? $editor->settings['upload_min_dimensions']['min_width'] : '',
+    '#size' => 8,
+    '#maxlength' => 8,
+    '#min' => 1,
+    '#max' => 99999,
+    '#placeholder' => 'width',
+    '#field_suffix' => ' x ',
+  );
+  $form['editor']['settings']['upload_min_dimensions']['min_height'] = array(
+    '#title' => t('Height'),
+    '#title_display' => 'invisible',
+    '#type' => 'number',
+    '#default_value' => isset($editor->settings['upload_min_dimensions']['min_height']) ? $editor->settings['upload_min_dimensions']['min_height'] : '',
+    '#size' => 8,
+    '#maxlength' => 8,
+    '#min' => 1,
+    '#max' => 99999,
+    '#placeholder' => 'height',
+    '#field_suffix' => 'pixels',
+  ); 
+
   // Add editor-specific validation and submit handlers.
   if ($editor) {
     $plugin = $manager->createInstance($editor->editor);
diff --git a/core/modules/editor/lib/Drupal/editor/Form/EditorImageDialog.php b/core/modules/editor/lib/Drupal/editor/Form/EditorImageDialog.php
index 0fa6249..dcbade6 100644
--- a/core/modules/editor/lib/Drupal/editor/Form/EditorImageDialog.php
+++ b/core/modules/editor/lib/Drupal/editor/Form/EditorImageDialog.php
@@ -41,6 +41,35 @@ class EditorImageDialog implements FormInterface {
     $form['#attached']['library'][] = array('editor', 'drupal.editor.dialog');
     $form['#prefix'] = '<div id="editor-image-dialog-form">';
     $form['#suffix'] = '</div>';
+    
+    $editor = editor_load($filter_format->format);
+
+    // Construct strings to use in the 
+    // file_validate_image_resolution validator  
+    if (!empty($editor->settings['upload_max_dimensions'])) {
+      $max_dimensions = $editor->settings['upload_max_dimensions']['max_width'] . 'x' . $editor->settings['upload_max_dimensions']['max_height'];
+    } else {
+      $max_dimensions = 0;
+    }   
+    if (!empty($editor->settings['upload_min_dimensions'])) {
+      $min_dimensions = $editor->settings['upload_min_dimensions']['min_width'] . 'x' . $editor->settings['upload_min_dimensions']['min_height'];
+    } else {
+      $min_dimensions = 0;
+    }     
+    $max_filesize = min(parse_size($settings->upload_file_size, file_upload_max_size()));
+
+    $form['fid'] = array(
+      '#title' => t('Image'),
+      '#type' => 'managed_file',
+      '#description' => t('The uploaded image will be displayed on this page.'),
+      '#upload_location' => file_build_uri($editor->settings['upload_directory']),
+      '#default_value' => isset($input['fid']) ? $input['fid'] : '',
+      '#upload_validators' => array(
+        'file_validate_extensions' => array('gif png jpg jpeg'),
+        'file_validate_size' => array($max_filesize),
+        'file_validate_image_resolution' => array($max_dimensions, $min_dimensions),
+      ),
+    );    
 
     // Everything under the "attributes" key is merged directly into the
     // generated img tag's attributes.
@@ -112,6 +141,9 @@ class EditorImageDialog implements FormInterface {
    * {@inheritdoc}
    */
   public function validateForm(array &$form, array &$form_state) {
+    if (empty($form_state['values']['attributes']['src']) && empty($form_state['values']['fid'][0])) {
+      form_set_error('src', t('No file or URL was given.') . $form_state['values']['fid'][0] . $form_state['values']['attributes']['src'] );
+    } 
   }
 
   /**
@@ -119,6 +151,19 @@ class EditorImageDialog implements FormInterface {
    */
   public function submitForm(array &$form, array &$form_state) {
     $response = new AjaxResponse();
+    
+    if ($form_state['values']['fid'][0]) {
+      $file = file_load((int) $form_state['values']['fid'][0]);
+      $file->status = FILE_STATUS_PERMANENT;
+      file_save($file);
+      file_usage_add($file, 'editor', 'editor', 1); 
+      
+      if (empty($form_state['values']['attributes']['src'])) {
+        // These will be added as attributes in hte resulting HTML
+        $form_state['values']['attributes']['src'] = file_create_url($file->uri);
+        $form_state['values']['attributes']['data-fid'] = $form_state['values']['fid'][0];
+      }  
+    } 
 
     if (form_get_errors()) {
       unset($form['#prefix'], $form['#suffix']);
