/ Published in: PHP
                    
                                        
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
/**
* Theme a image from a CCK Image Field with either theme('image'...) or theme('imagecache'...)
*
* @param array $imageCckField The CCK Image field array usually called with: $node->field_tools_image[0] for example
* @param array $attributes Associative array of attributes to be placed in the img tag for example array('class' => 'link')
* @param string Imagecache preset
* @return string A string containing the image tag.
*
* @link http://api.drupal.org/api/drupal/includes--theme.inc/function/theme_image/6 theme_image
* @link http://drupal.org/node/163561 Imagecache: dynamic image manipulation
*/
function _fremtidslaboratoriet_themeImage($imageCckField, $attributes = array(), $imagecachePreset = NULL)
{
$returnValue = NULL;
$filepath = $imageCckField['filepath'];
$alt = $imageCckField['data']['alt'];
$title = $imageCckField['data']['title'];
if(!$filepath)
{
return NULL;
}
if ($imagecachePreset == NULL)
{
$returnValue = theme('image', $filepath, $alt, $title, $attributes);
}
else
{
$returnValue = theme('imagecache', $imagecachePreset,$filepath, $alt, $title, $attributes);
}
return $returnValue;
}
Comments
 Subscribe to comments
                    Subscribe to comments
                
                