function theme_uc_option_image in Ubercart Option Images 6
Theme an option image.
@todo generate alt
Parameters
object $file: File object fetched by uc_option_image_load();
string $size: (optional) An imagecache preset or '_original'.
Return value
string Markup.
3 theme calls to theme_uc_option_image()
- theme_uc_option_image_preloaded in ./
uc_option_image.module - Theme option image preloaded images.
- uc_option_image_form_alter in ./
uc_option_image.module - Implements hook_form_alter().
- uc_option_image_nodeapi in ./
uc_option_image.module - Implements hook_nodeapi().
File
- ./
uc_option_image.module, line 586 - Provides image upload fields for attribute options. @author Tj Holowaychuk <tj@vision-media.ca/> @link http://vision-media.ca @todo supply 'default' image field when no option images are supplied or no option image attributes are…
Code
function theme_uc_option_image($aid, $file, $size = '_original') {
$shownoimage = TRUE;
if (!variable_get('uc_option_image_show_noimage', FALSE) && $file->filename == 'option_image_0_0_0') {
$file->filepath = NULL;
$shownoimage = FALSE;
}
$info = pathinfo($file->filepath);
$attributes = array(
'class' => 'uc-option-image',
);
// Display imagecache preset or the original image
$imagecache_image = '';
if ($shownoimage) {
if ($size != '_original') {
$imagecache_image = theme('imagecache', $size, $file->filepath, NULL, NULL, $attributes);
}
else {
$imagecache_image = theme('image', $file->filepath, NULL, NULL, $attributes, FALSE);
}
}
$option_image = '<div class="uc-option-image-block">' . $imagecache_image . '</div>';
return $option_image;
}