Index: img_assist.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/img_assist/Attic/img_assist.module,v
retrieving revision 1.68.2.35
diff -u -p -r1.68.2.35 img_assist.module
--- img_assist.module	23 Sep 2007 03:10:50 -0000	1.68.2.35
+++ img_assist.module	23 Sep 2007 05:53:44 -0000
@@ -247,26 +247,26 @@ function img_assist_admin_settings() {
   );
   $form['image']['img_assist_preview_count'] = array(
     '#type' => 'textfield',
-    '#title' => t('Max number of thumbnails per page'),
+    '#title' => t('Maximum number of thumbnails per page'),
     '#default_value' => variable_get('img_assist_preview_count', 8),
     '#size' => 6,
     '#maxlength' => 6,
-    '#description' => t('Enter the number of images to display in the thumbnail browser.  If there are more images, next and previous links will be displayed.'),
+    '#description' => t('Enter the number of images to display in the thumbnail browser. If there are more images, next and previous links will be displayed.'),
   );
   $form['image']['img_assist_max_size'] = array(
     '#type' => 'textfield',
-    '#title' => t('Max inline image size allowed'),
+    '#title' => t('Maximum inline image size allowed'),
     '#default_value' => variable_get('img_assist_max_size', '640x640'),
     '#size' => 9,
     '#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).'),
+    '#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')) {
     $max_size = explode('x', variable_get('img_assist_max_size', '640x640'));
     $oversize_count = 0;
     foreach (_image_get_sizes() as $key => $size) {
       $dimensions = $size['width'] .'x'. $size['height'];
-      if (($size['width'] <= $max_size[0]) && ($size['height'] <= $max_size[1])) {
+      if ((!empty($size['width']) && $size['width'] <= $max_size[0]) || (!empty($size['height']) && $size['height'] <= $max_size[1])) {
         $derivatives[$dimensions] = $size['label'];
       }
       elseif ($key == IMAGE_THUMBNAIL) {
@@ -287,7 +287,7 @@ function img_assist_admin_settings() {
       '#description' => t('Select the size of the image that is popped up.'),
     );
     
-    $oversize_alert = ($oversize_count) ? ' <strong>'. format_plural($oversize_count, '1 image size is not being shown because it exceeds the the maximum inline image size setting.', '%count image sizes are not being shown because they exceed the the maximum inline image size setting.') .'</strong>' : '';
+    $oversize_alert = ($oversize_count) ? '<br /><strong>'. format_plural($oversize_count, '1 image size is not being shown because it exceeds the the maximum inline image size setting (see above).', '@count image sizes are not being shown because they exceed the the maximum inline image size setting (see above).') .'</strong>' : '';
     $form['image']['img_assist_default_label'] = array(
       '#type' => 'select',
       '#title' => t('Default size for inline images'),
@@ -298,14 +298,14 @@ function img_assist_admin_settings() {
   }
   $form['image']['img_assist_create_derivatives'] = array(
     '#type' => 'checkboxes',
-    '#title' => t('Allow Image assist to create its own image derivatives?'),
+    '#title' => t('Creation of image derivatives'),
     '#default_value' => variable_get('img_assist_create_derivatives', array('properties', 'custom_all', 'custom_advanced')),
     '#options' => array(
-      'properties' => t('Yes, create 200x200 temporary images for the image properties window (useful if the thumbnail size is small)'),
-      'custom_all' => t('Yes, allow all Image assist users to create custom size inline images'),
-      'custom_advanced' => t('Yes, allow priviledged users to create custom size inline images'),
+      'properties' => t('Create 200x200 images for the image properties window (useful if the thumbnail size is small).'),
+      'custom_advanced' => t('Allow users with %access permission to create custom size inline images.', array('%access' => 'access advanced options')),
+      'custom_all' => t('Allow all users to create custom size inline images.'),
     ),
-    '#description' => t('These options allow Image assist to generate its custom image sizes (in the same manner as image.module) when a user would prefer a different size from the standard image sizes defined in the image.module settings.'),
+    '#description' => t('These options allow Image assist to generate its custom image sizes (in the same manner as image.module) when a user would prefer a different size from the default image sizes defined in the image.module settings.'),
   );
   
   // Other properties.
@@ -364,12 +364,23 @@ function img_assist_admin_settings() {
     '#title' => t('Include img_assist.css on all pages for styling inline images?'),
     '#default_value' => variable_get('img_assist_page_styling', 'yes'),
     '#options' => array('yes' => t('yes'), 'no' => t('no')),
-    '#description' => t('Advanced users can customize their theme\'s CSS file so that inclusion of the img_assist.css file will not be necessary.  See notes at the bottom of img_assist.css for details.'),
+    '#description' => t('Advanced users can customize their theme\'s CSS file so that inclusion of the img_assist.css file will not be necessary. See notes at the bottom of img_assist.css for details.'),
   );
+  
   return system_settings_form($form);
 }
 
 /**
+ * Validate Image Assist settings.
+ */
+function img_assist_admin_settings_validate($form_id, $form_values) {
+  // img_assist_max_size must contain a value for width and height.
+  if (!preg_match('/\d+x\d+/', $form_values['img_assist_max_size'])) {
+    form_set_error('img_assist_max_size', t('Allowed maximum inline image size hast to indicate width and height, for example %example.', array('%example' => '200x300')));
+  }
+}
+
+/**
  * Implementation of hook_filter().
  */
 function img_assist_filter($op, $delta = 0, $format = -1, $text = '') {
@@ -707,7 +718,7 @@ function img_assist_thumbs() {
       $output .= l($image, 'img_assist/properties/'. $node->nid, $attributes = array(), $query = NULL, $fragment = NULL, $absolute = FALSE, $html = TRUE) ."\n";
     }
     if (!db_num_rows($result)) {
-      $output .= t('No images were found.  Please upload a new image or browse images by a different category.');
+      $output .= t('No images were found. Please upload a new image or browse images by a different category.');
     }
     
     $output .= theme('pager', NULL, $show_amount);
