adding rel attribute to image link in a node I have a few images in a node that can be opened in a fancybox lightbox. I would like to link those images together to create a gallery. To do so I need to add a rel attribute to my image link. How can I do this?

I tried editing the field.tpl.php template, but without any luck.

Help would really be appreciated.
I need to add a rel attribute to my image link. How can I do
  this?


You can add a data attribute to your link in l() function:

// your image
$image = array(
    'style_name' =&gt; 'the name of the image style',
    'path' =&gt; 'relative path to your image',
    'alt' =&gt; '',
    'title' =&gt; '',
    'attributes' =&gt; array('class' =&gt; array('some_class'))
);

// link elements
$text = theme('image_style', $image); // in your case it's an image
$path = 'link_url';
$options = array(
    'attributes' =&gt; array(
        'class' =&gt; array('some_link_class'), 
        'rel' =&gt; 'some_relation'
    ),
    'html' =&gt; true
);

$link =  l($text, $path, $options);


result:

&lt;a class="some_link_class" rel="some_relation" href="/your_site/link_url"&gt;
    &lt;img src="path to your image style" class="some_class" typeof="foaf:Image"&gt;
&lt;/a&gt;