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' => 'the name of the image style',
'path' => 'relative path to your image',
'alt' => '',
'title' => '',
'attributes' => array('class' => array('some_class'))
);
// link elements
$text = theme('image_style', $image); // in your case it's an image
$path = 'link_url';
$options = array(
'attributes' => array(
'class' => array('some_link_class'),
'rel' => 'some_relation'
),
'html' => true
);
$link = l($text, $path, $options);
result:
<a class="some_link_class" rel="some_relation" href="/your_site/link_url">
<img src="path to your image style" class="some_class" typeof="foaf:Image">
</a>