The 'no image' png file in the uc_option_image module directory is named no_image.png but the code refers to it as noimage.png.

Comments

cybis’s picture

Title: no_image.png should be noimage.png » Imagecache error accessing noimage.png
Priority: Normal » Minor

Hmmm, my bad. The code refers to 'no_image.png' in the module directory and 'noimage.png' in the theme images directory. I'm getting an error accessing the noimage.png in the theme images directory. It seems imagecache is confused by this line in uc_option_image.module:

$filename = path_to_theme() . '/images/noimage.png';

Imagecache is looking for noimage.png here:

http://example.com/sites/default/files/imagecache/option_images/sites/all/modules/uc_option_image/images/noimage.png
ben coleman’s picture

Status: Active » Needs review
StatusFileSize
new921 bytes

I'm finding that the call to path_to_theme in theme_uc_option_image_no_image is returning the path to the module. This appears to be consistent with path_to_theme's documentation:

"If implemented from a module, it will point to the module."

(see http://api.drupal.org/api/drupal/includes--theme.inc/function/path_to_th...)

I've so far been patching it to point to the module-supplied no_image.png (see attached patch). What would probably be preferable would be to check and see if images/noimage.png exists in the current theme, use it if it is, but use the module-supplied no_image.png if it is not. Is there an equivalent to path_to_theme that give you the theme patch even if called from a module?

Note that theme_uc_option_image_no_image_path (which appears to be *supposed* to use the module-supplied no_image.png) uses noimage.png instead of no_image.png. The attached patch also fixes that.

ben coleman’s picture

Attached is a patch that will first check for images/noimage.png in the current theme, use it if it is there, or else use the module-supplied no_image.png.

Note that I had to use dirname($theme_info->filename) to get the directory for the current theme. Both path_to_theme and the global $theme_path variable return the path to the module when called from within the module. This is the only way I've so far found to do this.

cybis’s picture

Status: Needs review » Reviewed & tested by the community

Thanks Ben, patch #3 works for me.