Reviewed & tested by the community
Project:
Ubercart Option Images
Version:
6.x-1.x-dev
Component:
Miscellaneous
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
4 Jul 2011 at 15:48 UTC
Updated:
7 Oct 2011 at 20:49 UTC
Jump to comment: Most recent file
Comments
Comment #1
cybis commentedHmmm, 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:
Imagecache is looking for noimage.png here:
Comment #2
ben coleman commentedI'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.
Comment #3
ben coleman commentedAttached 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.
Comment #4
cybis commentedThanks Ben, patch #3 works for me.