? 20080812.session_login_without_cookie.patch
? 20080920.session_login_without_cookie.patch
? 20081016_drupalpost_cookie.patch
? backup
? simpletest-302075-20.patch
? simpletest-clearcookies.patch
? simpletest-clearcookies_0.patch
? simpletest-clearcookies_1.patch
? modules/simpletest/drupal_web_test_case.php.20090609
? sites/all/modules/imageapi_416254-14.patch
? sites/default/files
? sites/default/settings.php
Index: includes/image.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/image.inc,v
retrieving revision 1.33
diff -u -p -r1.33 image.inc
--- includes/image.inc	20 Apr 2009 20:02:30 -0000	1.33
+++ includes/image.inc	10 Aug 2009 22:53:14 -0000
@@ -101,36 +101,40 @@ function image_toolkit_invoke($method, s
 /**
  * Get details about an image.
  *
- * Drupal only supports GIF, JPG and PNG file formats.
+ * Drupal supports GIF, JPG and PNG file formats, and may support 
+ * others depending on which toolkits are installed.
  *
  * @param $filepath
  *   String specifying the path of the image file.
+ * @param $toolkit
+ *   An optional, image toolkit name to override the default.
  * @return
  *   FALSE, if the file could not be found or is not an image. Otherwise, a
  *   keyed array containing information about the image:
  *    'width'     - Width, in pixels.
  *    'height'    - Height, in pixels.
  *    'extension' - Commonly used file extension for the image.
- *    'mime_type' - MIME type ('image/jpeg', 'image/gif', 'image/png').
+ *    'mime_type' - MIME type, e.g. 'image/jpeg', 'image/gif', 'image/png'.
  *    'file_size' - File size in bytes.
  */
-function image_get_info($filepath) {
+function image_get_info($filepath, $toolkit = FALSE) {
   if (!is_file($filepath)) {
     return FALSE;
   }
 
   $details = FALSE;
-  $data = @getimagesize($filepath);
-  $file_size = @filesize($filepath);
 
-  if (isset($data) && is_array($data)) {
-    $extensions = array('1' => 'gif', '2' => 'jpg', '3' => 'png');
-    $extension = array_key_exists($data[2], $extensions) ?  $extensions[$data[2]] : '';
-    $details = array('width'     => $data[0],
-                     'height'    => $data[1],
-                     'extension' => $extension,
-                     'file_size' => $file_size,
-                     'mime_type' => $data['mime']);
+  if (!$toolkit) {
+    $toolkit = image_get_toolkit();
+  }
+  if ($toolkit) {
+    $image = new stdClass();
+    $image->source = $filepath;
+    $image->toolkit = $toolkit;
+    $details = image_toolkit_invoke('get_info', $image);
+    if (isset($details) && is_array($details)) {
+      $details['file_size'] = @filesize($filepath);
+    }
   }
 
   return $details;
@@ -343,10 +347,12 @@ function image_load($file, $toolkit = FA
   if ($toolkit) {
     $image = new stdClass();
     $image->source = $file;
-    $image->info = image_get_info($file);
-    $image->toolkit = $toolkit;
-    if (image_toolkit_invoke('load', $image)) {
-      return $image;
+    $image->info = image_get_info($file, $toolkit); 
+    if (isset($image->info) && is_array($image->info)) {
+      $image->toolkit = $toolkit;
+      if (image_toolkit_invoke('load', $image)) {
+        return $image;
+      }
     }
   }
   return FALSE;
@@ -374,7 +380,7 @@ function image_save(stdClass $image, $de
   if ($return = image_toolkit_invoke('save', $image, array($destination))) {
     // Clear the cached file size and refresh the image information.
     clearstatcache();
-    $image->info = image_get_info($destination);
+    $image->info = image_get_info($destination, $image->toolkit);
 
     if (drupal_chmod($destination)) {
       return $return;
Index: modules/image/image.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/image/image.admin.inc,v
retrieving revision 1.1
diff -u -p -r1.1 image.admin.inc
--- modules/image/image.admin.inc	21 Jul 2009 07:09:46 -0000	1.1
+++ modules/image/image.admin.inc	10 Aug 2009 22:53:15 -0000
@@ -563,6 +563,29 @@ function image_rotate_form($data) {
 }
 
 /**
+ * Form structure for the image convert form.
+ *
+ * Note that this is not a complete form, it only contains the portion of the
+ * form for configuring the rotate options. Therefore it does not not need to
+ * include metadata about the effect, nor a submit button.
+ *
+ * @param $data
+ *   The current configuration for this rotate effect.
+ */
+function image_convert_form($data) {
+  $form['format'] = array(
+    '#type' => 'select',
+    '#default_value' => (isset($data['format'])) ? $data['format'] : 'image/png',
+    '#title' => t('File format'),
+    '#description' => t('The format of the file to which the image should be converted.'),
+     '#default_value' => isset($action['format']) ? isset($action['format']) : 'image/png',
+    '#options' => _image_convert_file_formats(),
+    '#required' => TRUE,
+  );
+  return $form;
+}
+
+/**
  * Display the page containing the list of image styles.
  *
  * @param $styles
Index: modules/image/image.effects.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/image/image.effects.inc,v
retrieving revision 1.2
diff -u -p -r1.2 image.effects.inc
--- modules/image/image.effects.inc	21 Jul 2009 07:09:46 -0000	1.2
+++ modules/image/image.effects.inc	10 Aug 2009 22:53:15 -0000
@@ -51,6 +51,12 @@ function image_image_effect_info() {
       'form callback' => 'image_rotate_form',
       'summary theme' => 'image_rotate_summary',
     ),
+    'format' => array(
+      'label' => t('Change file format'),
+      'help' => t('Change the format of the file to a format such as png or jpeg. This can be useful to create smaller images if transparencies have been used  in the process.'),
+      'effect callback' => 'image_convert_effect',
+      'form callback' => 'image_convert_form',
+    )
   );
 
   return $effects;
@@ -238,3 +244,27 @@ function image_rotate_effect(&$image, $d
   }
   return TRUE;
 }
+
+/**
+ * Image effect callback; Convert an image resource to a different file format.
+ *
+ * @param $image
+ *   An image object returned by image_load().
+ * @param $data
+ *   An array of attributes to use when performing the rotate effect containing
+ *   the following items:
+ *   - "format": The file format of the image.
+* @return
+ *   TRUE.
+ */
+function image_convert_effect(&$image, $data = array()) {
+  $formats = _image_convert_file_formats();
+  $image->info['mime_type'] = $data['format'];
+  $image->info['extension'] = $formats[$data['format']];
+  return TRUE;
+}
+
+function _image_convert_file_formats() {
+  return array('image/jpeg' => 'jpg', 'image/gif' => 'gif', 'image/png' => 'png');
+}
+
Index: modules/simpletest/tests/image.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/image.test,v
retrieving revision 1.6
diff -u -p -r1.6 image.test
--- modules/simpletest/tests/image.test	13 Jul 2009 21:51:41 -0000	1.6
+++ modules/simpletest/tests/image.test	10 Aug 2009 22:53:16 -0000
@@ -96,7 +96,7 @@ class ImageToolkitUnitTest extends Image
     $image = image_load($this->file, $this->toolkit);
     $this->assertTrue(is_object($image), t('Returned an object.'));
     $this->assertEqual($this->toolkit, $image->toolkit, t('Image had toolkit set.'));
-    $this->assertToolkitOperationsCalled(array('load'));
+    $this->assertToolkitOperationsCalled(array('load', 'get_info'));
   }
 
   /**
Index: modules/simpletest/tests/image_test.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/image_test.module,v
retrieving revision 1.3
diff -u -p -r1.3 image_test.module
--- modules/simpletest/tests/image_test.module	27 May 2009 18:34:00 -0000	1.3
+++ modules/simpletest/tests/image_test.module	10 Aug 2009 22:53:16 -0000
@@ -58,8 +58,8 @@ function image_test_get_all_calls() {
  * Store the values passed to a toolkit call.
  *
  * @param $op
- *   One of the image toolkit operations: 'load', 'save', 'settings', 'resize',
- *   'rotate', 'crop', 'desaturate'.
+ *   One of the image toolkit operations: 'get_info', 'load', 'save', 
+ *   'settings', 'resize', 'rotate', 'crop', 'desaturate'.
  * @param $args
  *   Values passed to hook.
  * @see image_test_get_all_calls()
@@ -80,6 +80,14 @@ function image_test_settings() {
 }
 
 /**
+ * Image tookit's get_info operation.
+ */
+function image_test_get_info(stdClass $image) {
+  _image_test_log_call('get_info', array($image));
+  return array();
+}
+
+/**
  * Image tookit's load operation.
  */
 function image_test_load(stdClass $image) {
Index: modules/system/image.gd.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/image.gd.inc,v
retrieving revision 1.7
diff -u -p -r1.7 image.gd.inc
--- modules/system/image.gd.inc	21 Jul 2009 00:07:41 -0000	1.7
+++ modules/system/image.gd.inc	10 Aug 2009 22:53:16 -0000
@@ -316,5 +316,36 @@ function image_gd_create_tmp(stdClass $i
 }
 
 /**
+ * Get details about an image.
+ *
+ * @param $image
+ *   An image object.
+ * @return
+ *   FALSE, if the file could not be found or is not an image. Otherwise, a
+ *   keyed array containing information about the image:
+ *    'width'     - Width, in pixels.
+ *    'height'    - Height, in pixels.
+ *    'extension' - Commonly used file extension for the image.
+ *    'mime_type' - MIME type ('image/jpeg', 'image/gif', 'image/png').
+ *
+ * @see image_get_info()
+ */
+function image_gd_get_info(stdClass $image) {
+  $details = FALSE;
+  $data = @getimagesize($image->source);
+
+  if (isset($data) && is_array($data)) {
+    $extensions = array('1' => 'gif', '2' => 'jpg', '3' => 'png');
+    $extension = array_key_exists($data[2], $extensions) ?  $extensions[$data[2]] : '';
+    $details = array('width'     => $data[0],
+                     'height'    => $data[1],
+                     'extension' => $extension,
+                     'mime_type' => $data['mime']);
+  }
+
+  return $details;
+}
+
+/**
  * @} End of "ingroup image".
  */
