Last updated November 18, 2009. Created on September 15, 2009.
Edited by dambrisco, joachim. Log in to edit this page.

There's a special imagefield link module; however, if your site has developed with either of the separate fields alone to begin with, converting your data is perhaps not an option.

You can format an imagefield to display as a link with the URL from a link field by creating a field template for your image field like this:

  if (!empty($view->field['field_YOUR_LINK_FIELD_url']->field_alias)) {
    $data = $row->{$view->field['field_YOUR_LINK_FIELD_url']->field_alias};
    $url = link_cleanup_url($data);
<?php if ($url) : ?>
  <a href="<?php print $url; ?>">
    <?php print $output; ?>
<?php else : ?>
  <?php print $output; ?>
<?php endif; ?>

Looking for support? Visit the forums, or join #drupal-support in IRC.