Index: image_resize_filter.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/image_resize_filter/image_resize_filter.module,v retrieving revision 1.4 diff -u -r1.4 image_resize_filter.module --- image_resize_filter.module 11 Feb 2009 00:23:34 -0000 1.4 +++ image_resize_filter.module 11 Feb 2009 00:42:00 -0000 @@ -17,7 +17,9 @@ /** * Implementation of hook_filter(). */ -function image_resize_filter_filter($op, $delta = 0, $format = -1, $text = '') { +function image_resize_filter_filter($op, $delta = 0, $format = -1, $text = '', $cache_id = 0) { + static $images = array(); + switch ($op) { case 'list': return array(0 => t('Image resize filter')); @@ -28,11 +30,17 @@ case 'settings': return image_resize_filter_form($format); - case 'process': + case 'prepare': + // Get a list of images in this text *before* other filters are run. + // This makes is so that we can get the height and width within style + // properties before they are stripped out by the Filtered HTML filter. $settings['allowed_difference'] = variable_get('image_resize_filter_allowed_difference_'. $format, 20); $settings['image_locations'] = variable_get('image_resize_filter_image_locations_'. $format, array('local')); - $images = image_resize_filter_get_images($settings, $text); - return image_resize_filter_process($images, $text); + $images[$cache_id] = image_resize_filter_get_images($settings, $text); + return $text; + + case 'process': + return isset($images[$cache_id]) ? image_resize_filter_process($images[$cache_id], $text) : $text; default: return $text;