Index: image_exact.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/image_exact/image_exact.module,v retrieving revision 1.3.2.2 diff -u -F^f -r1.3.2.2 image_exact.module --- image_exact.module 26 Jun 2006 19:04:34 -0000 1.3.2.2 +++ image_exact.module 24 Jul 2006 10:50:05 -0000 @@ -36,12 +36,12 @@ function image_exact_settings() { '#description' => t('If checked, this will force images of the size(s) checked below (as defined on the %link) to be exactly the size specified. Otherwise, the settings below will be ignored.', array('%link' => $image_settings)), ); foreach (_image_get_sizes() as $count => $size) { - $options[$count] = $size['label']; + $options['size-'. $count] = $size['label']; } $form['image_exact_nodes']['image_exact_size'] = array( '#type' => 'checkboxes', '#title' => t('Specific Image Size Settings'), - '#default_value' => variable_get('image_exact_size', array(0)), + '#default_value' => variable_get('image_exact_size', array('size-0')), '#options' => $options, '#description' => t('Each image size checked will be cropped and resized to the specified size defined in the %link. Note that existing images will not be resized until viewing that specific image edit tab, and possibly refreshing the browser.', array('%link' => $image_settings)), ); @@ -75,14 +75,16 @@ function image_exact_nodeapi(&$node, $op //Set thumbnail final dimensions here - use settings from image content type. if ($node->type == 'image' && $op == 'validate' && variable_get('image_exact_thumbs', 1)) { $sizes = _image_get_sizes(); - foreach(variable_get('image_exact_size', array(0)) as $i) { -// for ($i = 0; $i < 5; $i++) { - $source = file_create_path($node->images['_original']); - $destination = file_create_path($node->images[$sizes[$i]['label']]); - $final_w = $sizes[$i]['width']; - $final_h = $sizes[$i]['height']; - if ($final_w && $final_h) { - image_exact_resize($source, $destination, $final_w, $final_h); + foreach(variable_get('image_exact_size', array('size-0')) as $i) { + if($i){ // unchecked options return 0 + $i = str_replace('size-', '', $i); + $source = file_create_path($node->images['_original']); + $destination = file_create_path($node->images[$sizes[$i]['label']]); + $final_w = $sizes[$i]['width']; + $final_h = $sizes[$i]['height']; + if ($final_w && $final_h) { + image_exact_resize($source, $destination, $final_w, $final_h); + } } } } @@ -128,10 +130,10 @@ function image_exact_resize($source, $de image_resize($destination, $destination, $final_w, $final_h); // drupal_set_message("Resize: $final_w, $final_h",'message'); if(!file_exists($destination)) { - drupal_set_message("Image_exact: Image resize failed.","error"); + drupal_set_message(t("Image_exact: Image resize failed."),"error"); } } else { - drupal_set_message('image_exact: File does not exist.','error'); + drupal_set_message(t('image_exact: File does not exist.'),'error'); } } ?>