? imageapi_6.patch
Index: imageapi.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imageapi/imageapi.info,v
retrieving revision 1.2
diff -u -p -r1.2 imageapi.info
--- imageapi.info	21 Feb 2008 11:21:05 -0000	1.2
+++ imageapi.info	11 Mar 2008 01:39:11 -0000
@@ -2,3 +2,5 @@
 name = ImageAPI
 description = ImageAPI supporting multiple toolkits.
 package = ImageCache
+core = 6.x
+php = 5.2
Index: imageapi.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imageapi/imageapi.module,v
retrieving revision 1.7
diff -u -p -r1.7 imageapi.module
--- imageapi.module	9 Mar 2008 04:46:24 -0000	1.7
+++ imageapi.module	11 Mar 2008 01:39:11 -0000
@@ -4,55 +4,49 @@
 /**
  * @file
  *
- * An ImageAPI supporting additional image plugins as modules. 
+ * An ImageAPI supporting additional image plugins as modules.
  * Images are treated as objects, and images are not written per
  * manipulation as Drupal's core image handling works.
- * 
- * 
- * imageapi image api workflow... 
+ *
+ *
+ * imageapi image api workflow...
  * $image = imageapi_image_open($path) to get an image object for $path...
  * image_X($image, $arg1, $arg2)  to manipulate image object...
  * imageapi_image_close($image) to overwrite original image.
- * 
+ *
  */
 
-define('IMAGEAPI_MINIMUM_PHP', '5.2');
-function imageapi_menu($may_cache) {
+function imageapi_menu() {
   $items = array();
-  if ($may_cache) {
-    $items[] = array(
-      'path' => 'admin/settings/imageapi',
-      'title' => t('ImageAPI'),
-      'description' => t('Configure ImageAPI.'),
-      'callback' => 'drupal_get_form',
-      'callback arguments' => array('imageapi_settings'),
+  $items['admin/settings/imageapi'] = array(
+    'title' => 'ImageAPI',
+    'description' => 'Configure ImageAPI.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('imageapi_settings'),
+    'access callback' => 'user_access',
+    'access arguments' => array('administer imageapi'),
+  );
+
+  $toolkits = imageapi_get_available_toolkits();
+  if ($toolkits) {
+    $items['admin/settings/imageapi/list'] = array(
+      'title' => 'List',
+      'type' => MENU_DEFAULT_LOCAL_TASK,
+      'weight' => -1,
     );
-  }
-  else {
-    $toolkits = imageapi_get_available_toolkits();
-    if ($toolkits) {
-      $items[] = array(
-        'path' => 'admin/settings/imageapi/list',
-        'title' => 'List',
-        'type' => MENU_DEFAULT_LOCAL_TASK,
-        'weight' => -1,
-      );
-      $items[] = array(
-        'path' => 'admin/settings/imageapi/config',
-        'title' => 'Configure',
-        'type' => MENU_LOCAL_TASK,
-        'callback' => 'drupal_get_form',
-        'callback arguments' => array(imageapi_default_toolkit() .'_settings_form'),
+    $items['admin/settings/imageapi/config'] = array(
+      'title' => 'Configure',
+      'type' => MENU_LOCAL_TASK,
+      'page callback' => 'drupal_get_form',
+      'page arguments' => array(imageapi_default_toolkit() .'_settings_form'),
+    );
+    foreach ($toolkits as $module => $info) {
+      $items['admin/settings/imageapi/config/'. $module] = array(
+        'title' => $info['name'],
+        'page callback' => 'drupal_get_form',
+        'page arguments' => array($module .'_settings_form'),
+        'type' => $module == imageapi_default_toolkit() ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK,
       );
-      foreach ($toolkits as $module => $info) {
-        $items[] = array(
-          'path' => 'admin/settings/imageapi/config/'. $module,
-          'title' => $info['name'],
-          'callback' => 'drupal_get_form',
-          'callback arguments' => array($module .'_settings_form'),
-          'type' => $module == imageapi_default_toolkit() ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK,
-        );
-      }
     }
   }
   return $items;
@@ -67,16 +61,16 @@ function imageapi_settings() {
     case 0:
       $form['imageapi_toolkits']['#value'] = t('There are no image toolkit modules enabled. Toolkit modules can be enabled from the <a href="!admin-build-modules">module configuration page</a>.', array('!admin-build-modules' => url('admin/build/modules')));
       return $form;
-    
+
     case 1:
       $toolkit = key($toolkits);
-      // The variable needs to be manually set. Otherwise, if a user has two 
-      // toolkits and disables the selected one they won't be able to select the 
+      // The variable needs to be manually set. Otherwise, if a user has two
+      // toolkits and disables the selected one they won't be able to select the
       // remaing toolkit.
       variable_set('imageapi_toolkit', $toolkit);
       $form['imageapi_image_toolkit']['#value'] = t('The %toolkit module is the only enabled image toolkit. Drupal will use it for resizing, cropping and other image manipulations.', array('%toolkit' => $toolkits[$toolkit]['name']));
       return $form;
-            
+
     default:
       $options = array();
       foreach ($toolkits as $module => $info) {
@@ -95,49 +89,30 @@ function imageapi_settings() {
 }
 
 /**
- *  Implementation of hook_requirements().
- */
-function imageapi_requirements($phase) {
-  $requirements = array();
-  // Ensure translations don't break at install time
-  $t = get_t();
-
-  if (version_compare(phpversion(), IMAGEAPI_MINIMUM_PHP) < 0) {
-    $requirements['imageapi_php'] = array(
-      'title' => $t('ImageAPI PHP'),
-      'description' => $t('ImageAPI requires at least PHP %version.', array('%version' => IMAGEAPI_MINIMUM_PHP)),
-      'severity' => REQUIREMENT_ERROR
-    );
-  }
-  
-  return $requirements;
-}
-
-/**
  * Return a list of available toolkits.
  *
- * @return 
+ * @return
  *   An array of the enabled image toolkit modules. The module name is the key
- *   and the value is a sub-array with the module's 'name' and 'description'.  
+ *   and the value is a sub-array with the module's 'name' and 'description'.
  */
 function imageapi_get_available_toolkits() {
   static $toolkits;
- 
+
   if (!isset($toolkits)) {
     $toolkits = array();
     foreach (module_implements('imageapi_toolkit', TRUE) as $module) {
-      $info = _module_parse_info_file(drupal_get_path('module', $module) .'/'. $module .'.info');
+      $info = drupal_parse_info_file(drupal_get_path('module', $module) .'/'. $module .'.info');
       $toolkits[$module] = array('name' => $info['name'], 'description' => $info['description']);
     }
   }
-  
+
   return $toolkits;
 }
 
 /**
  * Retrieve the name of the currently used toolkit.
  *
- * @return 
+ * @return
  *   String containing the name of the toolkit, or FALSE if none is available.
  */
 function imageapi_default_toolkit() {
@@ -170,7 +145,7 @@ function imageapi_image_scale_and_crop(&
   $scale = max($width / $image->info['width'], $height / $image->info['height']);
   $x = round(($image->info['width'] * $scale - $width) / 2);
   $y = round(($image->info['height'] * $scale - $height) / 2);
- 
+
   if (imageapi_image_resize($image, $image->info['width'] * $scale, $image->info['height'] * $scale)) {
     return imageapi_image_crop($image, $x, $y, $width, $height);
   }
@@ -207,10 +182,10 @@ function imageapi_image_scale(&$image, $
   else {
     $width = (int) round($height / $aspect);
   }
-  
+
   return call_user_func($image->toolkit .'_image_resize', $image, $width, $height);
 }
- 
+
 /**
  * Resize an image to the given dimensions (ignoring aspect ratio).
  *
@@ -231,7 +206,7 @@ function imageapi_image_scale(&$image, $
 function imageapi_image_resize(&$image, $width, $height) {
   return call_user_func($image->toolkit .'_image_resize', $image, $width, $height);
 }
- 
+
 /**
  * Rotate an image by the given number of degrees.
  *
@@ -242,8 +217,8 @@ function imageapi_image_resize(&$image, 
  * @param $degrees
  *   The number of (clockwise) degrees to rotate the image.
  * @param $bg_color
- *   An hexidecimal integer specifying the background color to use for the 
- *   uncovered area of the image after the rotation. E.g. 0x000000 for black, 
+ *   An hexidecimal integer specifying the background color to use for the
+ *   uncovered area of the image after the rotation. E.g. 0x000000 for black,
  *   0xff00ff for magenta, and 0xffffff for white.
  * @param $toolkit
  *   An optional override of the default image toolkit.
@@ -253,7 +228,7 @@ function imageapi_image_resize(&$image, 
 function imageapi_image_rotate(&$image, $degrees, $bgcolor = 0x000000) {
   return call_user_func($image->toolkit .'_image_rotate', $image, $degrees, $bgcolor);
 }
- 
+
 /**
  * Crop an image to the rectangle specified by the given rectangle.
  *
@@ -267,13 +242,13 @@ function imageapi_image_rotate(&$image, 
  *   The target width in pixels.
  * @param $height
  *   The target height in pixels.
- * @return 
+ * @return
  *   modifed image object.
  */
 function imageapi_image_crop(&$image, $x, $y, $width, $height) {
   return call_user_func($image->toolkit .'_image_crop', $image, $x, $y, $width, $height);
 }
- 
+
 
 function imageapi_image_desaturate(&$image) {
   return call_user_func($image->toolkit .'_image_desaturate', $image);
@@ -292,7 +267,7 @@ function imageapi_image_open($file, $too
       return $image;
     }
   }
-  watchdog('imageapi', t('ImageAPI failed to open %file with %toolkit', array('%file' => $file, '%toolkit' => $toolkit)), WATCHDOG_WARNING);
+  watchdog('imageapi', 'ImageAPI failed to open %file with %toolkit', array('%file' => $file, '%toolkit' => $toolkit), WATCHDOG_WARNING);
   return FALSE;
 }
 
Index: imageapi_gd.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imageapi/imageapi_gd.info,v
retrieving revision 1.2
diff -u -p -r1.2 imageapi_gd.info
--- imageapi_gd.info	21 Feb 2008 11:21:05 -0000	1.2
+++ imageapi_gd.info	11 Mar 2008 01:39:11 -0000
@@ -2,4 +2,5 @@
 name = ImageAPI GD2
 description = Uses PHP's built-in GD2 image processing support.
 package = ImageCache
-dependencies = imageapi
+dependencies[] = imageapi
+core = 6.x
Index: imageapi_gd.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imageapi/imageapi_gd.module,v
retrieving revision 1.2
diff -u -p -r1.2 imageapi_gd.module
--- imageapi_gd.module	23 Dec 2007 06:27:03 -0000	1.2
+++ imageapi_gd.module	11 Mar 2008 01:39:11 -0000
@@ -53,7 +53,7 @@ function imageapi_gd_image_crop(&$image,
   $image->info['width'] = $width;
   $image->info['height'] = $height;
   return TRUE;
-  
+
 }
 
 function imageapi_gd_image_resize(&$image, $width, $height) {
@@ -100,14 +100,14 @@ function imageapi_gd_image_rotate(&$imag
   imageDestroy($image->res);
   $image->res = $res;
   return TRUE;
-} 
+}
 
 function imageapi_gd_image_desaturate(&$image) {
   if (function_exists('imagefilter')) { // PHP 5
     if (!imagefilter($image->res, IMG_FILTER_GRAYSCALE)) {
        return FALSE;
     }
-  } 
+  }
   else {                              // PHP < 5
     $res = imageCreateTrueColor($image->info['width'], $image->info['height']);
     for ($y = 0; $y < $image->info['height']; ++$y) {
@@ -117,22 +117,22 @@ function imageapi_gd_image_desaturate(&$
           $red   = ($rgb >> 16) & 0xFF;
           $green = ($rgb >> 8)  & 0xFF;
           $blue  = $rgb & 0xFF;
-        } 
+        }
         else {
           $rgb = imagecolorsforindex($image->res, $rgb);
           $red   = $rgb['red'];
           $green = $rgb['green'];
           $blue  = $rgb['blue'];
         }
-         
+
         $gray = round(.299*$red + .587*$green + .114*$blue);
-         
+
         // shift gray level to the left
         $grayR = $gray << 16;   // R: red
         $grayG = $gray << 8;    // G: green
         $grayB = $gray;         // B: blue
         $grayColor = $grayR | $grayG | $grayB;
-        
+
         // set the pixel color
         imagesetpixel($res, $x, $y, $grayColor);
         imagecolorallocate($res, $gray, $gray, $gray);
Index: imageapi_imagick.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imageapi/imageapi_imagick.info,v
retrieving revision 1.2
diff -u -p -r1.2 imageapi_imagick.info
--- imageapi_imagick.info	21 Feb 2008 11:21:05 -0000	1.2
+++ imageapi_imagick.info	11 Mar 2008 01:39:11 -0000
@@ -2,4 +2,5 @@
 name = ImageAPI Imagick
 description = Experimental Imagick PHP extension image processing support.
 package = ImageCache
-dependencies = imageapi
+dependencies[] = imageapi
+core = 6.x
