diff --git a/uc_option_image.module b/uc_option_image.module index bdb680d..4f53bbe 100644 --- a/uc_option_image.module +++ b/uc_option_image.module @@ -82,7 +82,12 @@ function uc_option_image_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) { } // Load the default image file - $file = uc_option_image_load($node->nid, $first_attribute->aid, $default_option); + if ($first_attribute->required) { + $file = uc_option_image_load(0, 0, 0); + } + else { + $file = uc_option_image_load($node->nid, $first_attribute->aid, $default_option); + } // Display the image based on teaser/page view // Ensure that original file exists @@ -597,9 +602,14 @@ function uc_option_image_theme() { */ function theme_uc_option_image($aid, $file, $size = '_original', $node) { $shownoimage = TRUE; + // see note about $file being passed reference below + $filepath = $file->filepath; if (!variable_get('uc_option_image_show_noimage', FALSE) && $file->filename == 'option_image_0_0_0') { - $file->filepath = NULL; + // it would appear $file is passed by reference... set $filepath to NULL + // isntead of $file->filepath, which would cause any future lookups to be + // lacking a proper filepath + $filepath = NULL; $shownoimage = FALSE; } @@ -611,10 +621,10 @@ function theme_uc_option_image($aid, $file, $size = '_original', $node) { if ($shownoimage) { if ($size != '_original') { - $imagecache_image = theme('imagecache', $size, $file->filepath, NULL, NULL, $attributes); + $imagecache_image = theme('imagecache', $size, $filepath, NULL, NULL, $attributes); } else { - $imagecache_image = theme('image', $file->filepath, NULL, NULL, $attributes, FALSE); + $imagecache_image = theme('image', $filepath, NULL, NULL, $attributes, FALSE); } }