Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.720
diff -u -r1.720 system.module
--- modules/system/system.module	4 Jul 2009 14:29:34 -0000	1.720
+++ modules/system/system.module	4 Jul 2009 23:10:07 -0000
@@ -175,6 +175,37 @@
       'arguments' => array('content' => NULL),
       'file' => 'system.admin.inc',
     ),
+    'system_image_presets' => array(
+      'arguments' => array('presets' => NULL),
+      'file' => 'system.admin.inc',
+    ),
+    'system_image_preset_actions' => array(
+      'arguments' => array('form' => NULL),
+      'file' => 'system.admin.inc',
+    ),
+    'system_image_preset_preview' => array(
+      'arguments' => array('preset' => NULL),
+    ),
+    'system_image_resize_summary' => array(
+      'arguments' => array('data' => NULL),
+      'file' => 'image.actions.inc',
+    ),
+    'system_image_scale_summary' => array(
+      'arguments' => array('data' => NULL),
+      'file' => 'image.actions.inc',
+    ),
+    'system_image_crop_summary' => array(
+      'arguments' => array('data' => NULL),
+      'file' => 'image.actions.inc',
+    ),
+    'system_image_desaturate_summary' => array(
+      'arguments' => array('data' => NULL),
+      'file' => 'image.actions.inc',
+    ),
+    'system_image_rotate_summary' => array(
+      'arguments' => array('data' => NULL),
+      'file' => 'image.actions.inc',
+    ),
     'system_admin_by_module' => array(
       'arguments' => array('menu_items' => NULL),
       'file' => 'system.admin.inc',
@@ -209,6 +240,10 @@
       'title' => t('Administer files'),
       'description' => t('Manage user-uploaded files.'),
     ),
+    'administer image presets' => array(
+      'title' => t('Administer image presets'),
+      'description' => t('Create and modify presets for generating image modifications such as thumbnails.'),
+    ),
     'access administration pages' => array(
       'title' => t('Access administration pages'),
       'description' => t('View the administration panel and browse the help system.'),
@@ -706,6 +741,89 @@
     'page arguments' => array('system_file_system_settings'),
     'access arguments' => array('administer site configuration'),
   );
+  $items['admin/settings/image-presets'] = array(
+    'title' => 'Image presets',
+    'description' => 'Configure presets for generating image thumbnails and select an image toolkit.',
+    'page callback' => 'system_image_presets',
+    'access arguments' => array('administer image presets'),
+  );
+  $items['admin/settings/image-presets/list'] = array(
+    'title' => 'List',
+    'description' => 'List the current image presets on the site.',
+    'page callback' => 'system_image_presets',
+    'access arguments' => array('administer image presets'),
+    'type' => MENU_DEFAULT_LOCAL_TASK,
+    'weight' => 1,
+  );
+  $items['admin/settings/image-presets/add'] = array(
+    'title' => 'Add preset',
+    'description' => 'Add a new image preset.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('system_image_preset_add_form'),
+    'access arguments' => array('administer image presets'),
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 2,
+  );
+  $items['admin/settings/image-presets/edit/%image_preset'] = array(
+    'title' => 'Edit preset',
+    'title callback' => 'system_image_preset_title',
+    'title arguments' => array('Edit preset !name', 4),
+    'description' => 'Configure an image preset.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('system_image_preset_form', 4),
+    'access arguments' => array('administer image presets'),
+    'type' => MENU_CALLBACK,
+  );
+  $items['admin/settings/image-presets/delete/%image_preset'] = array(
+    'title' => 'Delete preset',
+    'title callback' => 'system_image_preset_title',
+    'title arguments' => array('Delete preset !name', 4),
+    'description' => 'Delete an image preset.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('system_image_preset_delete_form', 4, TRUE),
+    'access arguments' => array('administer image presets'),
+    'type' => MENU_CALLBACK,
+  );
+  $items['admin/settings/image-presets/flush/%image_preset'] = array(
+    'title' => 'Flush preset',
+    'title callback' => 'system_image_preset_title',
+    'title arguments' => array('Flush preset !name', 4),
+    'description' => 'Flush all the created images for a preset.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('system_image_preset_flush_form', 4, TRUE),
+    'access arguments' => array('administer image presets'),
+    'type' => MENU_CALLBACK,
+  );
+  $items['admin/settings/image-presets/edit/%image_preset/actions/%image_action'] = array(
+    'title' => 'Edit image action',
+    'title callback' => 'system_image_action_title',
+    'title arguments' => array('Edit !name action', 6),
+    'description' => 'Edit an exiting action within a preset.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('system_image_action_form', 4, 6),
+    'access arguments' => array('administer image presets'),
+    'type' => MENU_CALLBACK,
+  );
+  $items['admin/settings/image-presets/edit/%image_preset/actions/%image_action/delete'] = array(
+    'title' => 'Delete image action',
+    'title callback' => 'system_image_action_title',
+    'title arguments' => array('Delete !name action', 6),
+    'description' => 'Delete an exiting action from a preset.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('system_image_action_delete_form', 4, 6),
+    'access arguments' => array('administer image presets'),
+    'type' => MENU_CALLBACK,
+  );
+  $items['admin/settings/image-presets/edit/%image_preset/add/%image_action_definition'] = array(
+    'title' => 'Add image action',
+    'title callback' => 'system_image_action_title',
+    'title arguments' => array('Add !name action', 6),
+    'description' => 'Add a new action to a preset.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('system_image_action_form', 4, 6),
+    'access arguments' => array('administer image presets'),
+    'type' => MENU_CALLBACK,
+  );
   $items['admin/settings/image-toolkit'] = array(
     'title' => 'Image toolkit',
     'description' => 'Choose which image toolkit to use if you have installed optional toolkits.',
Index: modules/system/admin.css
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/admin.css,v
retrieving revision 1.20
diff -u -r1.20 admin.css
--- modules/system/admin.css	14 Jan 2009 12:18:37 -0000	1.20
+++ modules/system/admin.css	4 Jul 2009 23:10:05 -0000
@@ -114,6 +114,53 @@
   margin-top: 0;
 }
 
+/**
+ * Image preset configuration pages
+ */
+div.image-preset-new,
+div.image-preset-new div {
+  display: inline;
+}
+div.image-preset-preview {
+}
+div.image-preset-preview div.preview-image-wrapper {
+  text-align: center;
+  padding-bottom: 2em;
+  top: 50%;
+  width: 48%;
+  float: left;
+}
+div.image-preset-preview div.preview-image {
+  margin: auto;
+  position: relative;
+}
+div.image-preset-preview div.preview-image div.width {
+  position: absolute;
+  bottom: -6px;
+  left: -1px;
+  border: 1px solid #666;
+  border-top: none;
+  height: 2px;
+}
+div.image-preset-preview div.preview-image div.width span {
+  position: relative;
+  top: 4px;
+}
+div.image-preset-preview div.preview-image div.height {
+  position: absolute;
+  top: -1px;
+  right: -6px;
+  border: 1px solid #666;
+  border-left: none;
+  width: 2px;
+}
+div.image-preset-preview div.preview-image div.height span {
+  position: absolute;
+  top: 50%;
+  left: 10px;
+  height: 2em;
+  margin-top: -1em;
+}
 
 /**
  * Date and time settings page
Index: modules/system/system.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.info,v
retrieving revision 1.14
diff -u -r1.14 system.info
--- modules/system/system.info	17 Jun 2009 10:46:49 -0000	1.14
+++ modules/system/system.info	4 Jul 2009 23:10:05 -0000
@@ -6,6 +6,7 @@
 core = 7.x
 files[] = system.module
 files[] = system.admin.inc
+files[] = system.admin_image.inc
 files[] = system.queue.inc
 files[] = image.gd.inc
 files[] = system.install
Index: modules/system/system.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.test,v
retrieving revision 1.54
diff -u -r1.54 system.test
--- modules/system/system.test	1 Jul 2009 08:39:55 -0000	1.54
+++ modules/system/system.test	4 Jul 2009 23:10:08 -0000
@@ -487,6 +487,217 @@
 }
 
 /**
+ * Tests creation, deletion, and editing of image presets and actions.
+ */
+class AdminImagePresets extends DrupalWebTestCase {
+
+  /**
+   * Implementation of getInfo().
+   */
+  function getInfo() {
+    return array(
+      'name' => t('Image presets and actions configuration'),
+      'description' => t('Tests creation, deletion, and editing of image presets and actions.'),
+      'group' => t('System')
+    );
+  }
+
+  /**
+   * Implementation of setUp().
+   */
+  function setUp() {
+    parent::setUp();
+
+    // Create an administrative user.
+    $this->admin_user = $this->drupalCreateUser(array('administer site configuration', 'administer image presets'));
+    $this->drupalLogin($this->admin_user);
+  }
+
+  /**
+   * Given an image preset, generate an image.
+   */
+  function createSampleImage($preset) {
+    static $file_path;
+
+    // First, we need to make sure we have an image in our testing
+    // file directory. Copy over an image on the first run.
+    if (!isset($file_path)) {
+      $file = reset($this->drupalGetTestFiles('image'));
+      $file_path = file_unmanaged_copy($file->filename);
+    }
+
+    return image_preset_generate($preset['name'], $file_path) ? $file_path : FALSE;
+  }
+
+  /**
+   * Count the number of images currently create for a preset.
+   */
+  function getImageCount($preset) {
+    $directory = file_directory_path() . '/presets/' . $preset['name'];
+    return count(file_scan_directory($directory, '/.*/'));
+  }
+
+  function testPreset() {
+    // Setup a preset to be created and actions to add to it.
+    $preset_name = strtolower($this->randomName(10));
+    $preset_path = 'admin/settings/image-presets/' . $preset_name;
+    $action_edits = array(
+      'system_image_resize' => array(
+        'data[width]' => 100,
+        'data[height]' => 101,
+      ),
+      'system_image_scale' => array(
+        'data[width]' => 110,
+        'data[height]' => 111,
+        'data[upscale]' => 1,
+      ),
+      'system_image_scale_and_crop' => array(
+        'data[width]' => 120,
+        'data[height]' => 121,
+      ),
+      'system_image_crop' => array(
+        'data[width]' => 130,
+        'data[height]' => 131,
+        'data[xoffset]' => 1,
+        'data[yoffset]' => 2,
+      ),
+      'system_image_desaturate' => array(
+        // No options for desaturate.
+      ),
+      'system_image_rotate' => array(
+        'data[degrees]' => 5,
+        'data[random]' => 1,
+        'data[bgcolor]' => '#FFFF00',
+      ),
+    );
+
+    /* Add preset form. */
+
+    $edit = array(
+      'name' => $preset_name,
+    );
+    $this->drupalPost('admin/settings/image-presets/add', $edit, t('Create new preset'));
+    $this->assertRaw(t('Preset %name was created.', array('%name' => $preset_name)), t('Image preset successfully created.'));
+
+    /* Add action form. */
+
+    // Add each sample action to the preset.
+    foreach ($action_edits as $action => $edit) {
+      // Add the action.
+      $this->drupalPost($preset_path . '/add/' . $action, $edit, t('Add action'));
+    }
+
+    /* Edit action form. */
+
+    // Revisit each form to make sure the action was saved.
+    $preset = image_preset_load($preset_name);
+
+    foreach ($preset['actions'] as $iaid => $action) {
+      $this->drupalGet($preset_path . '/' . $iaid);
+      foreach ($action_edits[$action['action']] as $field => $value) {
+        $this->assertFieldByName($field, $value, t('The %field field in the %action action has the correct value of %value.', array('%field' => $field, '%action' => $action['action'], '%value' => $value)));
+      }
+    }
+
+    /* Image preset overview form (ordering and renaming). */
+
+    // Confirm the order of actions is maintained according to the order we
+    // added the fields.
+    $action_edits_order = array_keys($action_edits);
+    $actions_order = array_values($preset['actions']);
+    $order_correct = TRUE;
+    foreach ($actions_order as $index => $action) {
+      if ($action_edits_order[$index] != $action['action']) {
+        $order_correct = FALSE;
+      }
+    }
+    $this->assertTrue($order_correct, t('The order of the actions is correctly set by default.'));
+
+    // Test the preset overview form.
+    // Change the name of the preset and adjust the weights of actions.
+    $preset_name = strtolower($this->randomName(10));
+    $weight = count($action_edits);
+    $edit = array(
+      'name' => $preset_name,
+    );
+    foreach ($preset['actions'] as $iaid => $action) {
+      $edit['actions[' . $iaid . '][weight]'] = $weight;
+      $weight--;
+    }
+
+    // Create an image to make sure it gets flushed after saving.
+    $image_path = $this->createSampleImage($preset);
+    $this->assertEqual($this->getImageCount($preset), 1, t('Image preset %preset image %file successfully generated.', array('%preset' => $preset['name'], '%file' => $image_path)));
+
+    $this->drupalPost($preset_path, $edit, t('Update preset'));
+
+    // Note that after changing the preset name, the preset path is changed.
+    $preset_path = 'admin/settings/image-presets/' . $preset_name;
+
+    // Check that the URL was updated.
+    $this->drupalGet($preset_path);
+    $this->assertResponse(200, t('Image preset %original renamed to %new', array('%original' => $preset['name'], '%new' => $preset_name)));
+
+    // Check that the image was flushed after updating the preset.
+    // This is especially important when renaming the preset. Make sure that
+    // the old image directory has been deleted.
+    $this->assertEqual($this->getImageCount($preset), 0, t('Image preset %preset was flushed after renaming the preset and updating the order of actions.', array('%preset' => $preset['name'])));
+
+    // Load the preset by the new name with the new weights.
+    $preset = image_preset_load($preset_name, NULL, TRUE);
+
+    // Confirm the new preset order was saved.
+    $action_edits_order = array_reverse($action_edits_order);
+    $actions_order = array_values($preset['actions']);
+    $order_correct = TRUE;
+    foreach ($actions_order as $index => $action) {
+      if ($action_edits_order[$index] != $action['action']) {
+        $order_correct = FALSE;
+      }
+    }
+    $this->assertTrue($order_correct, t('The order of the actions is correctly set by default.'));
+
+    /* Image action deletion form. */
+
+    // Create an image to make sure it gets flushed after deleting an action.
+    $image_path = $this->createSampleImage($preset);
+    $this->assertEqual($this->getImageCount($preset), 1, t('Image preset %preset image %file successfully generated.', array('%preset' => $preset['name'], '%file' => $image_path)));
+
+    // Test action deletion form.
+    $action = array_pop($preset['actions']);
+    $this->drupalPost($preset_path . '/' . $action['iaid'] . '/delete', array(), t('Delete'));
+    $this->assertRaw(t('The image action %name has been deleted.', array('%name' => $action['name'])), t('Image action deleted.'));
+
+    // Check that the preset was flushed after deleting an action.
+    $this->assertEqual($this->getImageCount($preset), 0, t('Image preset %preset was flushed after deleting an action.', array('%preset' => $preset['name'])));
+
+    /* Preset flush form. */
+
+    // Create an image to make sure it gets flushed after deleting an action.
+    $image_path = $this->createSampleImage($preset);
+    $this->assertEqual($this->getImageCount($preset), 1, t('Image preset %preset image %file successfully generated.', array('%preset' => $preset['name'], '%file' => $image_path)));
+
+    $this->drupalPost($preset_path . '/flush', array(), t('Flush'));
+    $this->assertRaw(t('Preset %name was flushed.', array('%name' => $preset['name'])), t('Image preset %preset flush form submitted.'));
+
+    $this->assertEqual($this->getImageCount($preset), 0, t('Image preset %preset was flushed after submitting the flush form.', array('%preset' => $preset['name'])));
+
+    /* Preset deletion form. */
+
+    // Delete the preset.
+    $this->drupalPost($preset_path . '/delete', array(), t('Delete'));
+
+    // Confirm the preset directory has been removed.
+    $directory = file_directory_path() . '/presets/' . $preset_name;
+    $this->assertFalse(is_dir($directory), t('Image preset %preset directory removed on preset deletion.', array('%preset' => $preset['name'])));
+
+    // Confirm the preset is no longer available.
+    $this->assertFalse(image_preset_load($preset_name), t('Image preset %preset successfully deleted.', array('%preset' => $preset['name'])));
+
+  }
+}
+
+/**
  * Tests custom access denied functionality.
  */
 class AccessDeniedTestCase extends DrupalWebTestCase {
Index: includes/menu.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/menu.inc,v
retrieving revision 1.328
diff -u -r1.328 menu.inc
--- includes/menu.inc	10 Jun 2009 21:52:36 -0000	1.328
+++ includes/menu.inc	4 Jul 2009 23:10:04 -0000
@@ -210,7 +210,7 @@
  /**
  * The maximum number of path elements for a menu callback
  */
-define('MENU_MAX_PARTS', 7);
+define('MENU_MAX_PARTS', 8);
 
 
 /**
Index: modules/user/user.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.admin.inc,v
retrieving revision 1.60
diff -u -r1.60 user.admin.inc
--- modules/user/user.admin.inc	1 Jul 2009 08:39:56 -0000	1.60
+++ modules/user/user.admin.inc	4 Jul 2009 23:10:08 -0000
@@ -360,10 +360,21 @@
     '#maxlength' => 255,
     '#description' => t('URL of picture to display for users with no custom picture selected. Leave blank for none.'),
   );
+  $preset_options = array('' => t('Original image'));
+  foreach (image_presets() as $preset) {
+    $preset_options[$preset['name']] = $preset['name'];
+  }
+  $form['personalization']['pictures']['user_picture_preset'] = array(
+    '#type' => 'select',
+    '#title' => t('Picture image preset'),
+    '#default_value' => variable_get('user_picture_preset', ''),
+    '#options' => $preset_options,
+    '#description' => t('A preset may be used to give user pictures consistent display.'),
+  );
   $form['personalization']['pictures']['user_picture_dimensions'] = array(
     '#type' => 'textfield',
     '#title' => t('Picture maximum dimensions'),
-    '#default_value' => variable_get('user_picture_dimensions', '85x85'),
+    '#default_value' => variable_get('user_picture_dimensions', '1024x1024'),
     '#size' => 15,
     '#maxlength' => 10,
     '#description' => t('Maximum dimensions for pictures, in pixels.'),
@@ -371,7 +382,7 @@
   $form['personalization']['pictures']['user_picture_file_size'] = array(
     '#type' => 'textfield',
     '#title' => t('Picture maximum file size'),
-    '#default_value' => variable_get('user_picture_file_size', '30'),
+    '#default_value' => variable_get('user_picture_file_size', '800'),
     '#size' => 15,
     '#maxlength' => 10,
     '#description' => t('Maximum file size for pictures, in kB.'),
Index: modules/user/user.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.test,v
retrieving revision 1.44
diff -u -r1.44 user.test
--- modules/user/user.test	1 Jul 2009 12:06:22 -0000	1.44
+++ modules/user/user.test	4 Jul 2009 23:10:11 -0000
@@ -562,8 +562,14 @@
         // user's profile page.
         $text = t('The image was resized to fit within the maximum allowed dimensions of %dimensions pixels.', array('%dimensions' => $test_dim));
         $this->assertRaw($text, t('Image was resized.'));
+        if ($preset = variable_get('user_picture_preset', '')) {
+          $url_path = image_preset_path($preset, $pic_path, FALSE);
+        }
+        else {
+          $url_path = $pic_path;
+        }
         $alt = t("@user's picture", array('@user' => $this->user->name));
-        $this->assertRaw(theme('image', $pic_path, $alt, $alt, '', FALSE), t("Image is displayed in user's edit page"));
+        $this->assertRaw(theme('image', $url_path, $alt, $alt, NULL, FALSE), t("Image is displayed in user's edit page"));
 
         // Check if file is located in proper directory.
         $this->assertTrue(is_file($pic_path), t("File is located in proper directory"));
@@ -696,8 +702,14 @@
       $pic_path = $this->saveUserPicture($image);
 
       // Check if image is displayed in user's profile page.
+      if ($preset = variable_get('user_picture_preset', '')) {
+        $url_path = image_preset_path($preset, $pic_path, FALSE);
+      }
+      else {
+        $url_path = $pic_path;
+      }
       $this->drupalGet('user');
-      $this->assertRaw($pic_path, t("Image is displayed in user's profile page"));
+      $this->assertRaw($url_path, t("Image is displayed in user's profile page"));
 
       // Check if file is located in proper directory.
       $this->assertTrue(is_file($pic_path), t('File is located in proper directory'));
Index: modules/user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.1006
diff -u -r1.1006 user.module
--- modules/user/user.module	2 Jul 2009 15:07:37 -0000	1.1006
+++ modules/user/user.module	4 Jul 2009 23:10:10 -0000
@@ -588,8 +588,8 @@
   // If required, validate the uploaded picture.
   $validators = array(
     'file_validate_is_image' => array(),
-    'file_validate_image_resolution' => array(variable_get('user_picture_dimensions', '85x85')),
-    'file_validate_size' => array(variable_get('user_picture_file_size', '30') * 1024),
+    'file_validate_image_resolution' => array(variable_get('user_picture_dimensions', '1024x1024')),
+    'file_validate_size' => array(variable_get('user_picture_file_size', '800') * 1024),
   );
 
   // Save the file as a temporary file.
@@ -1162,7 +1162,12 @@
     }
     if (isset($filepath)) {
       $alt = t("@user's picture", array('@user' => $account->name ? $account->name : variable_get('anonymous', t('Anonymous'))));
-      $variables['picture'] = theme('image', $filepath, $alt, $alt, '', FALSE);
+      if ($preset = variable_get('user_picture_preset', '')) {
+        $variables['picture'] = theme('image_preset', $preset, $filepath, $alt, $alt, NULL, FALSE);
+      }
+      else {
+        $variables['picture'] = theme('image', $filepath, $alt, $alt, NULL, FALSE);
+      }
       if (!empty($account->uid) && user_access('access user profiles')) {
         $attributes = array('attributes' => array('title' => t('View user profile.')), 'html' => TRUE);
         $variables['picture'] = l($variables['picture'], "user/$account->uid", $attributes);
@@ -1862,7 +1867,7 @@
       '#type' => 'file',
       '#title' => t('Upload picture'),
       '#size' => 48,
-      '#description' => t('Your virtual face or picture. Maximum dimensions are %dimensions pixels and the maximum size is %size kB.', array('%dimensions' => variable_get('user_picture_dimensions', '85x85'), '%size' => variable_get('user_picture_file_size', '30'))) . ' ' . variable_get('user_picture_guidelines', ''),
+      '#description' => t('Your virtual face or picture. Maximum dimensions are %dimensions pixels and the maximum size is %size kB.', array('%dimensions' => variable_get('user_picture_dimensions', '1024x1024'), '%size' => variable_get('user_picture_file_size', '800'))) . ' ' . variable_get('user_picture_guidelines', ''),
     );
     $form['#validate'][] = 'user_validate_picture';
   }
Index: profiles/default/default.profile
===================================================================
RCS file: /cvs/drupal/drupal/profiles/default/default.profile,v
retrieving revision 1.52
diff -u -r1.52 default.profile
--- profiles/default/default.profile	4 Jul 2009 13:39:52 -0000	1.52
+++ profiles/default/default.profile	4 Jul 2009 23:10:11 -0000
@@ -196,6 +196,25 @@
   // Don't display date and author information for page nodes by default.
   variable_set('node_submitted_page', FALSE);
 
+  // Create an image preset.
+  $preset = array('name' => 'thumbnail_square');
+  $preset = image_preset_save($preset);
+  $action = array(
+    'ipid' => $preset['ipid'],
+    'action' => 'system_image_scale_and_crop',
+    'data' => array('width' => '85', 'height' => '85'),
+  );
+  image_action_save($action);
+
+  // Enable user picture support and set the default to a square thumbnail option.
+  variable_set('user_pictures', '1');
+  variable_set('user_picture_preset', 'thumbnail_square');
+
+  $theme_settings = theme_get_settings();
+  $theme_settings['toggle_node_user_picture'] = '1';
+  $theme_settings['toggle_comment_user_picture'] = '1';
+  variable_set('theme_settings', $theme_settings);
+
   // Create a default vocabulary named "Tags", enabled for the 'article' content type.
   $description = st('Use tags to group articles on similar topics into categories.');
   $help = st('Enter a comma-separated list of words.');
Index: modules/system/system.admin_image.inc
===================================================================
RCS file: modules/system/system.admin_image.inc
diff -N modules/system/system.admin_image.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/system/system.admin_image.inc	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,725 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Administration pages for image settings.
+ */
+
+/**
+ * Menu callback; Listing of all current image presets.
+ */
+function system_image_presets() {
+  $presets = image_presets();
+  return theme('system_image_presets', $presets);
+}
+
+/**
+ * Menu title callback; Title for editing, deleting, and flushing presets.
+ */
+function system_image_preset_title($string, $preset) {
+  return t($string, array('!name' => $preset['name']));
+}
+
+/**
+ * Form builder; Edit a preset name and action order.
+ *
+ * @param $form_state
+ *   An associative array containing the current state of the form.
+ * @param $preset
+ *   An image preset array.
+ * @ingroup forms
+ * @see system_image_preset_form_submit()
+ * @see system_image_preset_name_validate()
+ */
+function system_image_preset_form(&$form_state, $preset) {
+  $form_state['image_preset'] = $preset;
+  $form = array(
+    '#tree' => TRUE,
+  );
+
+  $form['name'] = array(
+    '#type' => 'textfield',
+    '#size' => '64',
+    '#title' => t('Preset name'),
+    '#default_value' => $preset['name'],
+    '#description' => t('The name is used in URLs for generated images. Only use lowercase alphanumeric characters, underscores (_), and hyphens (-) for preset names.'),
+    '#element_validate' => array('system_image_preset_name_validate'),
+  );
+
+  $form['actions'] = array(
+    '#theme' => 'system_image_preset_actions',
+  );
+
+  foreach ($preset['actions'] as $iaid => $action) {
+    $form['actions'][$iaid]['#weight'] = isset($form_state['input']['actions']) ? $form_state['input']['actions'][$iaid]['weight'] : NULL;
+    $form['actions'][$iaid]['name'] = array(
+      '#markup' => $action['name'],
+    );
+    $form['actions'][$iaid]['summary'] = array(
+      '#markup' => theme($action['summary'], $action['data']),
+    );
+    $form['actions'][$iaid]['weight'] = array(
+      '#type' => 'weight',
+      '#default_value' => $action['weight'],
+    );
+    $form['actions'][$iaid]['configure'] = array(
+      '#markup' => ($action['data']) ? l(t('Configure'), 'admin/settings/image-presets/edit/'. $preset['name'] .'/actions/'. $action['iaid'] ) : '',
+    );
+    $form['actions'][$iaid]['remove'] = array(
+      '#markup' => l(t('Delete'), 'admin/settings/image-presets/edit/'. $preset['name'] .'/actions/'. $action['iaid'] .'/delete'),
+    );
+  }
+
+  $new_action_options = array('' => t('Select a new action'));
+  foreach (image_action_definitions() as $action => $definition) {
+    $new_action_options[$action] = check_plain($definition['name']);
+  }
+  $form['actions']['new'] = array(
+    '#tree' => FALSE,
+    '#weight' => isset($form_state['input']['weight']) ? $form_state['input']['weight'] : NULL,
+  );
+  $form['actions']['new']['new'] = array(
+    '#type' => 'select',
+    '#options' => $new_action_options,
+  );
+  $form['actions']['new']['weight'] = array(
+    '#type' => 'weight',
+    '#default_value' => count($form['actions']) - 1,
+  );
+  $form['actions']['new']['add'] = array(
+    '#type' => 'submit',
+    '#value' => t('Add'),
+    '#validate' => array('system_image_preset_form_add_validate'),
+    '#submit' => array('system_image_preset_form_submit', 'system_image_preset_form_add_submit'),
+  );
+
+  $form['preview'] = array(
+    '#type' => 'item',
+    '#title' => t('Preview'),
+    '#markup' => theme('system_image_preset_preview', $preset),
+    '#description' => t('Preview images are scaled. Actual image sizes may be viewed by clicking on the preview.'),
+  );
+
+  $form['submit'] = array(
+    '#type' => 'submit',
+    '#value' => t('Update preset'),
+  );
+
+  return $form;
+}
+
+/**
+ * Validate handler for adding a new action to a preset.
+ */
+function system_image_preset_form_add_validate($form, &$form_state) {
+  if (!$form_state['values']['new']) {
+    form_error($form['actions']['new']['new'], t('Select an action to add.'));
+    $form_state['rebuild'] = TRUE;
+  }
+}
+
+/**
+ * Submit handler for adding a new action to a preset.
+ */
+function system_image_preset_form_add_submit($form, &$form_state) {
+  $path = 'admin/settings/image-presets/edit/' . $form_state['image_preset']['name'] . '/add/' . $form_state['values']['new'];
+  $form_state['redirect'] = array($path, array('weight' => $form_state['values']['weight']));
+}
+
+/**
+ * Submit handler for saving an image preset.
+ */
+function system_image_preset_form_submit($form, &$form_state) {
+  // Update the preset name if it has changed.
+  $preset = $form_state['image_preset'];
+  if ($preset['name'] != $form_state['values']['name']) {
+    $preset['name'] = $form_state['values']['name'];
+  }
+
+  foreach ($form_state['values']['actions'] as $iaid => $action_data) {
+    if (is_numeric($iaid) && isset($preset['actions'][$iaid])) {
+      $action = $preset['actions'][$iaid];
+      $action['weight'] = $action_data['weight'];
+      image_action_save($action);
+    }
+  }
+
+  image_preset_save($preset);
+  if ($form_state['values']['op'] == t('Update preset')) {
+    drupal_set_message('Changes to the preset have been saved.');
+  }
+  $form_state['redirect'] = 'admin/settings/image-presets/edit/' . $preset['name'];
+}
+
+/**
+ * Form builder; Form for adding a new preset.
+ *
+ * @ingroup forms
+ * @see system_image_preset_add_form_submit()
+ * @see system_image_preset_name_validate()
+ */
+function system_image_preset_add_form(&$form_state) {
+  $form = array();
+  $form['name'] = array(
+    '#type' => 'textfield',
+    '#size' => '64',
+    '#title' => t('Preset name'),
+    '#default_value' => '',
+    '#description' => t('The name is used in URLs for generated images. Only use lowercase alphanumeric characters, underscores (_), and hyphens (-) for preset names.'),
+    '#element_validate' => array('system_image_preset_name_validate'),
+  );
+  $form['submit'] = array(
+    '#type' => 'submit',
+    '#value' => t('Create new preset'),
+  );
+  return $form;
+}
+
+/**
+ * Submit handler for adding a new preset.
+ */
+function  system_image_preset_add_form_submit($form, &$form_state) {
+  $preset = array('name' => $form_state['values']['name']);
+  $preset = image_preset_save($preset);
+  drupal_set_message(t('Preset %name was created.', array('%name' => $preset['name'])));
+  $form_state['redirect'] = 'admin/settings/image-presets/edit/'. $preset['name'];
+}
+
+/**
+ * Element validate function to ensure unique, URL safe preset names.
+ */
+function system_image_preset_name_validate($element, $form_state) {
+  // Check for duplicates.
+  $presets = image_presets();
+  if (isset($presets[$element['#value']]) && (!isset($form_state['image_preset']['ipid']) || $presets[$element['#value']]['ipid'] != $form_state['image_preset']['ipid'])) {
+    form_set_error($element['#name'], t('The image preset name %name is already in use.', array('%name' => $element['#value'])));
+  }
+
+  // Check for illegal characters in preset names.
+  if (preg_match('/[^0-9a-z_\-]/', $element['#value'])) {
+    form_set_error($element['#name'], t('Please only use lowercase alphanumeric characters, underscores (_), and hyphens (-) for preset names.'));
+  }
+}
+
+/**
+ * Form builder; Form for deleting an image preset.
+ *
+ * @param $preset
+ *   An image preset array.
+ *
+ * @ingroup forms
+ * @see system_image_preset_delete_form_submit()
+ */
+function system_image_preset_delete_form($form_state, $preset) {
+  $form_state['image_preset'] = $preset;
+
+  $form = array();
+  return confirm_form(
+    $form,
+    t('Are you sure you want to delete the preset %preset?', array('%preset' => $preset['name'])),
+    'admin/settings/image-presets',
+    t('All images that have been generated for this preset will be permanently deleted.'),
+    t('Delete'),  t('Cancel')
+  );
+}
+
+/**
+ * Submit handler to delete an image preset.
+ */
+function system_image_preset_delete_form_submit($form, &$form_state) {
+  $preset = $form_state['image_preset'];
+
+  image_preset_delete($preset);
+  cache_clear_all();
+  drupal_set_message(t('Preset %name was deleted.', array('%name' => $preset['name'])));
+  $form_state['redirect'] = 'admin/settings/image-presets';
+}
+
+/**
+ * Form builder; Confirm flushing a preset's cached images.
+ *
+ * @param $preset
+ *   An image preset array.
+ * @ingroup forms
+ * @see system_image_preset_flush_form_submit()
+ */
+function system_image_preset_flush_form(&$form_state, $preset) {
+  $form_state['image_preset'] = $preset;
+
+  $form = array();
+  return confirm_form(
+    $form,
+    t('Are you sure you want to flush the %preset preset?', array('%preset' => $preset['name'])),
+    'admin/settings/image-presets',
+    t('This will delete all the generated images for the %preset preset. Regenerating the images may cause a temporary increase in your server\'s load.', array('%preset' => $preset['name'])),
+    t('Flush'),  t('Cancel')
+  );
+}
+
+/**
+ * Submit handler for flushing an image preset's cached files.
+ */
+function system_image_preset_flush_form_submit($form, &$form_state) {
+  $preset = $form_state['image_preset'];
+  image_preset_flush($preset);
+  drupal_set_message(t('Preset %name was flushed.', array('%name' => $preset['name'])));
+  $form_state['redirect'] = 'admin/settings/image-presets';
+}
+
+/**
+ * Menu title callback; Title for editing, deleting, and adding image actions.
+ *
+ * @param $action
+ *   An image action array.
+ */
+function system_image_action_title($string, $action) {
+  return t($string, array('!name' => $action['name']));
+}
+
+/**
+ * Form builder; Form for adding and editing image actions.
+ *
+ * This form is used universally for editing all actions. Each action adds its
+ * own custom section to the form by calling the form function specified in
+ * hook_image_actions().
+ *
+ * @param $form_state
+ *   An associative array containing the current state of the form.
+ * @param $preset
+ *   An image preset array.
+ * @param $action
+ *   An image action array.
+ *
+ * @ingroup forms
+ * @see hook_image_actions()
+ * @see system_image_actions()
+ * @see system_image_resize_form()
+ * @see system_image_scale_form()
+ * @see system_image_rotate_form()
+ * @see system_image_crop_form()
+ * @see system_image_desaturate_form()
+ * @see system_image_action_form_submit()
+ */
+function system_image_action_form(&$form_state, $preset, $action) {
+  $form_state['image_preset'] = $preset;
+  $form_state['image_action'] = $action;
+
+  $form = array('#tree' => TRUE);
+  if (drupal_function_exists($action['form'])) {
+    $form['data'] = call_user_func($action['form'], $action['data']);
+  }
+
+  // Check if the URL provides a weight, then the action, otherwise use default.
+  $form['weight'] = array(
+    '#type' => 'hidden',
+    '#value' => isset($_GET['weight']) ? intval($_GET['weight']) : (isset($action['weight']) ? $action['weight'] : count($preset['actions'])),
+  );
+
+  $form['submit'] = array(
+    '#type' => 'submit',
+    '#value' => isset($action['iaid']) ? t('Update action') : t('Add action'),
+  );
+
+  return $form;
+}
+
+/**
+ * Submit handler for updating an image action.
+ */
+function system_image_action_form_submit($form, &$form_state) {
+  $preset = $form_state['image_preset'];
+  $action = array_merge($form_state['image_action'], $form_state['values']);
+  $action['ipid'] = $preset['ipid'];
+
+  image_action_save($action);
+  drupal_set_message(t('The action was successfully updated.'));
+  $form_state['redirect'] = 'admin/settings/image-presets/edit/'. $preset['name'];
+}
+
+/**
+ * Form builder; Form for deleting an image action.
+ *
+ * @params $preset
+ *   Name of the preset to remove the action from.
+ * @params $action
+ *   Name of the action to remove.
+ * @ingroup forms
+ * @see system_image_action_delete_form_submit()
+ */
+function system_image_action_delete_form(&$form_state, $preset, $action) {
+  $form_state['image_preset'] = $preset;
+  $form_state['image_action'] = $action;
+
+  $form = array();
+  $question = t('Are you sure you want to delete the @action action from the %preset preset?', array('%preset' => $preset['name'], '@action' => $action['name']));
+  $description = t('Deleting this action will regenerate all images for the %preset preset.', array('%preset' => $preset['name']));
+  return confirm_form($form, $question, 'admin/settings/image-presets/edit/' . $preset['name'], $description, t('Delete'));
+}
+
+/**
+ * Submit handler to delete an image action.
+ */
+function system_image_action_delete_form_submit($form, &$form_state) {
+  $preset = $form_state['image_preset'];
+  $action = $form_state['image_action'];
+
+  image_action_delete($action);
+  drupal_set_message(t('The image action %name has been deleted.', array('%name' => $action['name'])));
+  $form_state['redirect'] = 'admin/settings/image-presets/edit/'. $preset['name'];
+}
+
+/**
+ * Form structure for the image resize form.
+ *
+ * Note that this is not a complete form, it only contains the portion of the
+ * form for configuring the resize options. Therefor it does not not need to
+ * include metadata about the action, nor a submit button.
+ *
+ * @param $data
+ *   The current configuration for this resize action.
+ */
+function system_image_resize_form($data) {
+  $form['width'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Width'),
+    '#default_value' => isset($data['width']) ? $data['width'] : '',
+    '#description' => t('Enter a width in pixels or as a percentage. i.e. 500 or 80%.'),
+    '#required' => TRUE,
+  );
+  $form['height'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Height'),
+    '#default_value' => isset($data['height']) ? $data['height'] : '',
+    '#description' => t('Enter a height in pixels or as a percentage. i.e. 500 or 80%.'),
+    '#required' => TRUE,
+  );
+  return $form;
+}
+
+/**
+ * Form structure for the image scale form.
+ *
+ * Note that this is not a complete form, it only contains the portion of the
+ * form for configuring the scale options. Therefor it does not not need to
+ * include metadata about the action, nor a submit button.
+ *
+ * @param $data
+ *   The current configuration for this scale action.
+ */
+function system_image_scale_form($data) {
+  $form = system_image_resize_form($data);
+  $form['width']['#required'] = FALSE;
+  $form['height']['#required'] = FALSE;
+  $form['upscale'] = array(
+    '#type' => 'checkbox',
+    '#default_value' => (isset($data['upscale'])) ? $data['upscale'] : 0,
+    '#title' => t('Allow Upscaling'),
+    '#description' => t('Let scale make images larger than their original size'),
+  );
+  return $form;
+}
+
+/**
+ * Form structure for the image crop form.
+ *
+ * Note that this is not a complete form, it only contains the portion of the
+ * form for configuring the crop options. Therefor it does not not need to
+ * include metadata about the action, nor a submit button.
+ *
+ * @param $data
+ *   The current configuration for this crop action.
+ */
+function system_image_crop_form($data) {
+  $data += array(
+    'width' => '',
+    'height' => '',
+    'xoffset' => '',
+    'yoffset' => '',
+  );
+
+  $form['width'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Width'),
+    '#default_value' => $data['width'],
+    '#description' => t('Enter a width in pixels or as a percentage. i.e. 500 or 80%.'),
+    '#required' => TRUE,
+  );
+  $form['height'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Height'),
+    '#default_value' => $data['height'],
+    '#description' => t('Enter a height in pixels or as a percentage. i.e. 500 or 80%.'),
+    '#required' => TRUE,
+  );
+  $form['xoffset'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Horizontal offset'),
+    '#default_value' => $data['xoffset'],
+    '#description' => t('Enter a x-axis offset in pixels or use a keyword: <em>left</em>, <em>center</em>, or <em>right</em>.'),
+  );
+  $form['yoffset'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Vertical offset'),
+    '#default_value' => $data['yoffset'],
+    '#description' => t('Enter a y-axis offset in pixels or use a keyword: <em>top</em>, <em>center</em>, or <em>bottom</em>.'),
+  );
+  return $form;
+}
+
+/**
+ * Form structure for the image desaturate form.
+ *
+ * Note that this is not a complete form, it only contains the portion of the
+ * form for configuring the desaturate options. Therefor it does not not need to
+ * include metadata about the action, nor a submit button.
+ *
+ * @param $data
+ *   The current configuration for this crop action.
+ */
+function system_image_desaturate_form($data) {
+  return array(
+    '#markup' => '<div class="messages status">' . t('The desaturate action needs no configuration. Confirm the addition of this action.') . '</div>',
+  );
+}
+
+/**
+ * Form structure for the image rotate form.
+ *
+ * Note that this is not a complete form, it only contains the portion of the
+ * form for configuring the rotate options. Therefor it does not not need to
+ * include metadata about the action, nor a submit button.
+ *
+ * @param $data
+ *   The current configuration for this rotate action.
+ */
+function system_image_rotate_form($data) {
+  $form['degrees'] = array(
+    '#type' => 'textfield',
+    '#default_value' => (isset($data['degrees'])) ? $data['degrees'] : 0,
+    '#title' => t('Rotation angle'),
+    '#description' => t('The number of degrees the image should be rotated. Positive numbers are clockwise, negative are counter-clockwise.'),
+    '#required' => TRUE,
+  );
+  $form['random'] = array(
+    '#type' => 'checkbox',
+    '#default_value' => (isset($data['random'])) ? $data['random'] : 0,
+    '#title' => t('Randomize'),
+    '#description' => t('Randomize the rotation angle for each image. The angle specified above is used as a maximum.'),
+  );
+  $form['bgcolor'] = array(
+    '#type' => 'textfield',
+    '#default_value' => (isset($data['bgcolor'])) ? $data['bgcolor'] : '#FFFFFF',
+    '#title' => t('Background color'),
+    '#description' => t('The background color to use for exposed areas of the image. Use web-style hex colors (#FFFFFF for white, #000000 for black).'),
+    '#required' => TRUE,
+  );
+  return $form;
+}
+
+/**
+ * Display the page containing the list of image presets.
+ *
+ * @param $presets
+ *   An array of all the image presets returned by image_get_presets().
+ * @see image_get_presets()
+ * @ingroup themeable
+ */
+function theme_system_image_presets($presets) {
+  $header = array(t('Preset name'), array('data' => t('Operations'), 'colspan' => 3));
+  $rows = array();
+  foreach ($presets as $preset) {
+    $row = array();
+    $row[] = l($preset['name'], 'admin/settings/image-presets/edit/' . $preset['name']);
+    $link_attributes = array(
+      'attributes' => array(
+        'class' => 'image-preset-link',
+      ),
+    );
+    $row[] = l(t('Edit'), 'admin/settings/image-presets/edit/' . $preset['name'], $link_attributes);
+    $row[] = l(t('Flush'), 'admin/settings/image-presets/flush/' . $preset['name'], $link_attributes);
+    $row[] = l(t('Delete'), 'admin/settings/image-presets/delete/' . $preset['name'], $link_attributes);
+    $rows[] = $row;
+  }
+
+  if (empty($rows)) {
+    $rows[] = array(array(
+      'colspan' => 4,
+      'data' => t('There are currently no presets. <a href="!url">Add a new one</a>.', array('!url' => url('admin/settings/image-presets/add'))),
+    ));
+  }
+
+  return theme('table', $header, $rows);
+}
+
+/**
+ * Theme callback for listing the actions within a specific image preset.
+ *
+ * @param $form
+ *   An associative array containing the structure of the actions group.
+ * @ingroup themeable
+ */
+function theme_system_image_preset_actions($form) {
+  $rows = array();
+
+  foreach (element_children($form) as $key) {
+    if (is_numeric($key)) {
+      $form[$key]['weight']['#attributes']['class'] = 'image-action-order-weight';
+      $summary = drupal_render($form[$key]['summary']);
+      $row = array();
+      $row[] = drupal_render($form[$key]['name']) . (empty($summary) ? '' : ' ' . $summary);
+      $row[] = drupal_render($form[$key]['weight']);
+      $row[] = drupal_render($form[$key]['configure']);
+      $row[] = drupal_render($form[$key]['remove']);
+    }
+    else {
+      // Add the row for adding a new action.
+      $form['new']['weight']['#attributes']['class'] = 'image-action-order-weight';
+      $row = array();
+      $row[] = '<div class="image-preset-new">' . drupal_render($form['new']['new']) . drupal_render($form['new']['add']) . '</div>';
+      $row[] = drupal_render($form['new']['weight']);
+      $row[] = array('data' => '', 'colspan' => 2);
+    }
+
+    $rows[] = array(
+      'data' => $row,
+      'class' => 'draggable',
+    );
+  }
+
+  $header = array(
+    t('Action'),
+    t('Weight'),
+    array('data' => t('Operations'), 'colspan' => 2),
+  );
+
+  if (empty($rows)) {
+    $rows[] = array(array(
+      'data' => t('There are currently no actions in this preset. Add one by selecting an option below.'),
+      'colspan' => 4,
+    ));
+  }
+
+  $output = theme('table', $header, $rows, array('id' => 'image-preset-actions'));
+  drupal_add_tabledrag('image-preset-actions', 'order', 'sibling', 'image-action-order-weight');
+  return $output;
+}
+
+/**
+ * Theme callback for displaying a preview of a preset.
+ */
+function theme_system_image_preset_preview($preset) {
+  $sample_image = variable_get('image_preset_preview_image', 'misc/sample.jpg');
+  $sample_width = 160;
+  $sample_height = 160;
+
+  // Set up original file information.
+  $original_path = $sample_image;
+  $original_image = image_get_info($original_path);
+  if ($original_image['width'] > $original_image['height']) {
+    $original_width = min($original_image['width'], $sample_width);
+    $original_height = round($original_width / $original_image['width'] * $original_image['height']);
+  }
+  else {
+    $original_height = min($original_image['height'], $sample_height);
+    $original_width = round($original_height / $original_image['height'] * $original_image['width']);
+  }
+  $original_attributes = array_intersect_key($original_image, array('width' => '', 'height' => ''));
+  $original_attributes['style'] = 'width: ' . $original_width . 'px; height: ' . $original_height . 'px;';
+
+  // Set up preview file information.
+  $preview_file = image_preset_path($preset['name'], $original_path);
+  $preview_path = file_create_path($preview_file);
+  if (!file_exists($preview_path) && image_preset_create_derivative($preset, $original_path, $preview_file)) {
+    $preview_path = file_create_path($preview_file);
+  }
+  $preview_image = image_get_info($preview_path);
+  if ($preview_image['width'] > $preview_image['height']) {
+    $preview_width = min($preview_image['width'], $sample_width);
+    $preview_height = round($preview_width / $preview_image['width'] * $preview_image['height']);
+  }
+  else {
+    $preview_height = min($preview_image['height'], $sample_height);
+    $preview_width = round($preview_height / $preview_image['height'] * $preview_image['width']);
+  }
+  $preview_attributes = array_intersect_key($preview_image, array('width' => '', 'height' => ''));
+  $preview_attributes['style'] = 'width: ' . $preview_width . 'px; height: ' . $preview_height . 'px;';
+
+  // Timestamps are added on output to prevent caching of preview images.
+  $output = '';
+  $output .= '<div class="image-preset-preview preview clearfix">';
+  $output .= '<div class="preview-image-wrapper">';
+  $output .= t('original image');
+  $output .= '<div class="preview-image original-image" style="' . $original_attributes['style'] . '">';
+  $output .= '<a href="' . url($original_path) . '?' . time() . '">' . theme('image', $original_path . '?' . time(), t('Sample original image'), '', $original_attributes) . '</a>';
+  $output .= '<div class="height" style="height: ' . $original_height . 'px"><span>' . $original_image['height'] . 'px</span></div>';
+  $output .= '<div class="width" style="width: ' . $original_width . 'px"><span>' . $original_image['width'] . 'px</span></div>';
+  $output .= '</div>'; // End preview-image.
+  $output .= '</div>'; // End preview-image-wrapper.
+  $output .= '<div class="preview-image-wrapper">';
+  $output .= check_plain($preset['name']);
+  $output .= '<div class="preview-image modified-image" style="' . $preview_attributes['style'] . '">';
+  $output .= '<a href="' . file_create_url($preview_file) . '?' . time() . '">' . theme('image', file_create_url($preview_file) . '?' . time(), t('Sample modified image'), '', $preview_attributes) . '</a>';
+  $output .= '<div class="height" style="height: ' . $preview_height . 'px"><span>' . $preview_image['height'] . 'px</span></div>';
+  $output .= '<div class="width" style="width: ' . $preview_width . 'px"><span>' . $preview_image['width'] . 'px</span></div>';
+  $output .= '</div>'; // End preview-image.
+  $output .= '</div>'; // End preview-image-wrapper.
+  $output .= '</div>'; // End image-preset-preview.
+
+  return $output;
+}
+
+/**
+ * Theme callback for image resize action summary output.
+ *
+ * @param $data
+ *   The current configuration for this resize action.
+ * @ingroup themeable
+ */
+function theme_system_image_resize_summary($data) {
+  return $data['width'] . 'x' . $data['height'];
+}
+
+/**
+ * Theme callback for image scale action summary output.
+ *
+ * @param $data
+ *   The current configuration for this scale action.
+ * @ingroup themeable
+ */
+function theme_system_image_scale_summary($data) {
+  return theme('system_image_resize_summary', $data) . ' ' . ($data['upscale'] ? t('upscale') : t('no upscale'));
+}
+
+/**
+ * Theme callback for image crop action summary output.
+ *
+ * @param $data
+ *   The current configuration for this crop action.
+ * @ingroup themeable
+ */
+function theme_system_image_crop_summary($data) {
+  return $data['width'] . 'x' . $data['height'];
+}
+
+/**
+ * Theme callback for image desaturate action summary output.
+ *
+ * @param $data
+ *   The current configuration for this desaturate action.
+ * @ingroup themeable
+ */
+function theme_system_image_desaturate_summary($data) {
+  return '';
+}
+
+/**
+ * Theme callback for image rotate action summary output.
+ *
+ * @param $data
+ *   The current configuration for this rotate action.
+ * @ingroup themeable
+ */
+function theme_system_image_rotate_summary($data) {
+  return t('@degrees°', array('@degrees' => $data['degrees'])) . ($data['random'] ? (' (' . t('random') . ')') : '');
+}
