I have created a content type that allows users to upload a PDF File (Brochure) and an Image (Brochure Cover). So I have two fields (field_brochure and field_brochure_cover).
I'm trying to find the best method to set a link to the file from the image.
My only attempts have been modifying the template.php file. I first attempted to update the description of field_brochure to include an 'img' tag, i.e.:
if (field_get_items('node', $vars['node'], 'field_brochure_cover')){
$cover = field_get_items('node', $vars['node'], 'field_brochure_cover');
$cover_path = $base_path.conf_path().'/files/'.file_uri_target($cover[0]['uri']);
if(isset($vars["page"]["content"]["system_main"]["nodes"]) && count($vars["page"]["content"]["system_main"]["nodes"]) == 2){
$keys = array_keys($vars["page"]["content"]["system_main"]["nodes"]);
$field_brochure = $vars['page']['content']['system_main']['nodes'][$keys[0]]['field_brochure'][0]['#file'];
$field_brochure->description = "<img src=\"".$cover_path."\" />";
}
}
But, this placed the HTML in the output, converting the characters to html entities.
I also set the Image (in Manage Display) to "Link image to: File", and then attempted to change the path of that link:
<?php