Theme image cache function in drupal

Posted by: 
Dominique De Cooman

Used to resize images, scale and crop images. Use it allot.
Install the image cache module. Create a preset and call it with this function.

example $image 
theme('imagecache''nieuws_teaser'$node->field_image[0]['filepath'], $node->field_image[0]['data']['alt'], $node->field_image[0]['data']['title'], array('description' => $node->field_image[0]['data']['description']));

@namespace : name of preset
@path path of image
@alttitleattributes html attributes of the img tag

function theme_imagecache($namespace$path$alt ''$title ''$attributes NULL) {
$attributes drupal_attributes($attributes);
$imagecache_path file_create_url(file_directory_path() .'/imagecache/'$namespace .'/'$path);
'<img src="'$imagecache_path .'" alt="'check_plain($alt) .'" title="'check_plain($title) .'" '$attributes .' />';

Add new comment

Who are you?

By knowing who you are you will be directed to a page where we have displayed all our drupal services relevant to your professional identity.