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 21 Aug 2006 04:36:05 -0000 @@ -65,22 +65,23 @@ function image_exact_settings() { return $form; } -/* -* Implementation of hook_nodeapi -* -* Looks for images and if the setting is set will resize thumbs -*/ - -function image_exact_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) { - //Set thumbnail final dimensions here - use settings from image content type. - if ($node->type == 'image' && $op == 'validate' && variable_get('image_exact_thumbs', 1)) { +/** + * Implementation of hook_image_modify_derivative() + */ +function image_exact_image_modify_derivative($node, $destination, $size) { + if (variable_get('image_exact_thumbs', 1)) { + $exact = variable_get('image_exact_size', array(0)); $sizes = _image_get_sizes(); - foreach(variable_get('image_exact_size', array(0)) as $i) { -// for ($i = 0; $i < 5; $i++) { + foreach ($sizes as $key => $params) { + if ($params['label'] == $size) { + $size = $key; + break; + } + } + if (isset($exact[$size])) { $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']; + $final_w = $sizes[$size]['width']; + $final_h = $sizes[$size]['height']; if ($final_w && $final_h) { image_exact_resize($source, $destination, $final_w, $final_h); }