Drupal: add a link to a image free cck field & re-indent

186 Views Asked by At

I am working on theming the product page for drupal ubercart and can't seem to get the image to be a link also. This is what I have so far:

<?php  
if ($node->field_image_cache[0]['filepath']):
    print theme('imagecache', 'uc_thumbmail', $node->field_image_cache[0]['filepath']); 
endif;
?>  

The link has to link to the full image which is product_full opposed to uc_thumbnail and I'm trying to make it into a light box also but I will be happy to even get the link to work.

2

There are 2 best solutions below

0
On BEST ANSWER

try

<a href=""><?php print theme_imagefield_image($node->field_image[0]); ?></a>

not sure if that is what you want but it should print a link from cck

0
On

On Drupal 7, you may take advantage of the native l() function:

echo l(theme_imagefield_image($node->field_image[0]), "link-destination", Array("html"=> true)) ;