? imageapi.module.patch
Index: imageapi.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imageapi/imageapi.module,v
retrieving revision 1.19
diff -u -p -r1.19 imageapi.module
--- imageapi.module	19 Jun 2008 22:29:19 -0000	1.19
+++ imageapi.module	20 Jun 2008 00:06:29 -0000
@@ -160,8 +160,8 @@ function imageapi_image_scale_and_crop(&
   if (empty($width)) $width = $height * $aspect;
 
   $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);
+  $x = (int) round(($image->info['width'] * $scale - $width) / 2);
+  $y = (int) 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);
@@ -191,20 +191,23 @@ function imageapi_image_scale(&$image, $
   $aspect = $image->info['height'] / $image->info['width'];
   if (empty($height)) $height = $width / $aspect;
   if (empty($width)) $width = $height * $aspect;
-   
+  
   // Don't scale up.
-  if (!$upscale && $width >= $image->info['width'] && $height >= $image->info['height']) {
+  if (!$upscale && round($width) >= $image->info['width'] && round($height) >= $image->info['height']) {
     return true;
   }
 
   $aspect = $image->info['height'] / $image->info['width'];
   if ($aspect < $height / $width) {
-    $height = (int) round($width * $aspect);
+    $height = $width * $aspect;
   }
   else {
-    $width = (int) round($height / $aspect);
+    $width = $height / $aspect;
   }
 
+  $width = (int) round($width);
+  $height = (int) round($height);
+
   return call_user_func($image->toolkit .'_image_resize', $image, $width, $height);
 }
 
@@ -226,6 +229,9 @@ function imageapi_image_scale(&$image, $
  *   True or false, based on success.
  */
 function imageapi_image_resize(&$image, $width, $height) {
+  $width = (int) round($width);
+  $height = (int) round($height);
+  
   return call_user_func($image->toolkit .'_image_resize', $image, $width, $height);
 }
 
@@ -268,6 +274,9 @@ function imageapi_image_crop(&$image, $x
   if (empty($height)) $height = $width / $aspect;
   if (empty($width)) $width = $height * $aspect;
 
+  $width = (int) round($width);
+  $height = (int) round($height);
+
   return call_user_func($image->toolkit .'_image_crop', $image, $x, $y, $width, $height);
 }
 
