Index: img_assist.module
===================================================================
--- img_assist.module	(revision 131)
+++ img_assist.module	(working copy)
@@ -251,11 +251,11 @@
     '#maxlength' => 9,
     '#description' => t('Enter the number of maximum image dimension to display with Image assist.  This is a way to prevent users from breaking your layouts.  This is applied when the filter tag is processed, so it will affect existing images.  If an existing image exceeds these dimensions, a smaller derivative of the image will be substituted (or a smaller version will be created if you have allowed Image assist to create its own derivatives).'),
   );
-  if (function_exists('_image_get_sizes')) {
+  if (function_exists('image_get_sizes')) {
     // get maximum size allowed inline
     $max_size = explode('x', variable_get('img_assist_max_size', '640x640'));
     $oversize_count = 0;
-    foreach (_image_get_sizes() as $size) {
+    foreach (image_get_sizes() as $size) {
       if ($size['label']) {
         $dimensions = $size['width'] .'x'. $size['height'];
         if (($size['width'] <= $max_size[0]) && ($size['height'] <= $max_size[1])) {
@@ -768,7 +768,7 @@
   // arbitrary size you choose.
   $max_size = explode('x', variable_get('img_assist_max_size', '640x640'));
   $default_label = variable_get('img_assist_default_label', 'thumbnail');
-  foreach (_image_get_sizes() as $size) {
+  foreach (image_get_sizes() as $size) {
     if ($size['label']) {
       if (($size['width'] <= $max_size[0]) && ($size['height'] <= $max_size[1])) {
         $derivatives[$size['width'] .'x'. $size['height']] = $size['label'];
@@ -1111,14 +1111,14 @@
     if (is_array($size)) { // size can be an array without the width and/or height
       $size = $size['label'];
     }
-    foreach (_image_get_sizes() as $stdsize) {
+    foreach (image_get_sizes() as $stdsize) {
       if ($stdsize['label'] == $size) {
         $sizes[] = $stdsize;
       }
     }
   }
   else { // no size given: rebuild derivatives for all standard sizes
-    $sizes = _image_get_sizes();
+    $sizes = image_get_sizes();
   }
 
   foreach ($sizes as $size) {
@@ -1207,7 +1207,7 @@
           $diag_size_new = sqrt(pow($width, 2) + pow($height, 2));
           $closest_difference = 9999;
 
-          foreach (_image_get_sizes() as $stdsize) {
+          foreach (image_get_sizes() as $key => $stdsize) {
             if ($stdsize['label']) {
               $width_std = $stdsize['width'];
               $height_std = $stdsize['height'];
@@ -1222,7 +1222,7 @@
               $diag_size_std = sqrt(pow($width_std, 2) + pow($height_std, 2));
               $difference = abs($diag_size_new - $diag_size_std);
               if ($difference < $closest_difference) {
-                $closest_std_size = $stdsize['label'];
+                $closest_std_size = $key;
                 $closest_difference = $difference;
               }
             }
@@ -1278,7 +1278,7 @@
       }
     }
     else { // default to thumbnail if the width and/or height is missing
-      foreach (_image_get_sizes() as $stdsize) {
+      foreach (image_get_sizes() as $stdsize) {
         if ($stdsize['label'] == 'thumbnail') {
           $size = $stdsize;
         }
@@ -1670,8 +1670,8 @@
   }
   else {
     $image_module_image = FALSE;
-    if (function_exists('_image_get_sizes')) {
-      foreach (_image_get_sizes() as $size) {
+    if (function_exists('image_get_sizes')) {
+      foreach (image_get_sizes() as $size) {
         if ($size['label'] == $node->filename) {
           $image_module_image = TRUE;
           $result = db_query(db_rewrite_sql('SELECT n.nid, n.title, r.teaser, f.* FROM {files} f, {node} n INNER JOIN {node_revisions} r ON r.nid = n.nid AND r.vid = n.nid WHERE f.nid = n.nid AND n.nid = %d'), $node->nid);
