--- nodeimageblock/nodeimageblock.module	2007-05-28 15:18:33.000000000 +0200
+++ nodeimageblock/nodeimageblock.module	2007-05-28 15:36:03.000000000 +0200
@@ -11,10 +11,26 @@
  *
  * Displays all images that are attached to the current node
  */
-function nodeimageblock_block($op = 'list', $delta = 0) {
+function nodeimageblock_block($op = 'list', $delta = 0, $edit = array()) {
   if ($op == 'list') {
 	  $block[0]['info'] = 'Node Image';
   }
+  elseif ($op == 'configure' &&  module_exists('imagecache')) {
+    $options = _imagecache_get_presets();
+    $options[0] = t('<none>');
+    ksort($options);
+    $form[nodeimageblock_imagecahce_preset] = array(
+      '#type' => 'select',
+      '#title' => 'Imagecache preset',
+      '#description' => 'Choose the Imagecache preset to use for the images in the Node Image Block.',
+      '#options' => $options,
+      '#default_value' => variable_get('nodeimageblock_imagecahce_preset', 0),
+    );
+    return $form;
+  }
+  elseif ($op == 'save') {
+    variable_set('nodeimageblock_imagecahce_preset', $edit['nodeimageblock_imagecahce_preset']);
+  }
   elseif($op == 'view') {
     if(arg(0) == 'node') {
       $nid = arg(1);
@@ -25,8 +41,18 @@ function nodeimageblock_block($op = 'lis
 
   			if(count($imagesrc) > 0) {
   			  $output = '';
+          if (($imagecache_preset = variable_get('nodeimageblock_imagecahce_preset', 0)) && module_exists('imagecache')) {
+            $imagecache_preset = _imagecache_preset_load($imagecache_preset);
     			foreach($imagesrc as $img) {
+              $img = theme('imagecache', $imagecache_preset, $img);
       			$output .= theme('nodeimageblock_block_item', $node, $img);
+            }
+          }
+          else {
+            foreach($imagesrc as $img) {
+              $img = theme('nodeimageblock_no_imagecache', $img);
+              $output .= theme('nodeimageblock_block_item', $node, $img);
+            }
           }
 
     			$block['subject'] = '';
@@ -46,15 +72,20 @@ function theme_nodeimageblock_block($ite
 	return $output;
 }
 
-function theme_nodeimageblock_block_item($node, $imagesrc) {
+function theme_nodeimageblock_block_item($node, $img) {
 	$output = '
 	<div class="nodeimage">
-	    <img src="' . $imagesrc . '" alt="" />
+		' .$img. '
 	</div>';
 
 	return $output;
 }
 
+function theme_nodeimageblock_no_imagecache($img) {
+  $img = file_create_url($img);
+  return '<img src="' .$img. '" alt="" />';
+}
+
 function _nodeimageblock_get_node_images($node) {
 	$filepath = '';
 
@@ -67,7 +98,7 @@ function _nodeimageblock_get_node_images
 
 			// --- Is the file an image?
 			if(in_array($file->filemime, $image_mime)) {
-				$images[] = file_create_url($file->filepath);
+        $images[] = $file->filepath;
 			}
 		}
 	}
