I have a multi-value CCK field set up using the Link Image Field module, and I need to print all of the images (linked) on the content page. I used the code below to print the images themselves, but cannot figure out how to wrap each image's link around each image.
<?php if ($node->field_day_option_buttons[0]['filepath']): ?>
<?php
foreach($node->field_day_option_buttons as $image) {
if (file_exists($image['filepath'])) {
print theme_imagecache('my image cache preset name', $image['filepath']);
}
}
?>
<?php endif; ?>
Can anyone provide input on how to accomplish that?
Thanks!
EDIT Here is the info placed on the page when I run a print(r) on that cck field:
Array (
[0] => Array (
[fid] => 347
[uid] => 1
[filename] => days-5.png
[filepath] => sites/default/files/days-5_0.png
[filemime] => image/png
[filesize] => 440
[status] => 1
[timestamp] => 1366038083
[list] => 1
[data] => Array (
[alt] => Alt Text
[title] => Title Text
[url] => http://www.mysite.com
[target] => _self
)
[nid] => 18
)
[1] => Array (
[fid] => 348
[uid] => 1
[filename] => days-20.png
[filepath] => sites/default/files/days-20_0.png
[filemime] => image/png
[filesize] => 506
[status] => 1
[timestamp] => 1366038108
[list] => 1
[data] => Array (
[alt] => Alt Text
[title] => Title Text
[url] => http://www.mysite.com
[target] => _self
)
[nid] => 18
)
)
$image
besides 'filepath', eg can you give us a print_r() or equivalent of the rest of the data you have to work with. I am assuming somewhere in there is the link/url you need to grab.$image['data']['url']
info and then use that with @Boriana's answer below.