How do I link an image field to an pdf file I have a challenge in linking my image to a pdf file. I have a content type with 2 fields, image field which will contain the cover picture and an attachment field which is file of type pdf.

In my view am trying to link an image to attachment so that when a user clicks on the image it open a pdf file.

In some instances where am just using description to link to a pdf file, this what I have put in my Global PHP(Description) output code in my view. 
nid, 'filename.pdf');
?>
As soon as click on the description my pdf opens. works fine

But I need to do the same thing with my image, to just click on image then should open my pdf file. Any idea???
Hope this will help you,

In Drupal 7 you can use VIEWS Rewrite results to link an IMAGE to a PDF file.

Steps:


In PDF field, exclude it and change the format to "URL of file"


Go to your VIEW -> Image field and under Link image to select NOTHING
And then go to Rewrite results and check Output this field as a
link and give the path of the PDF file. 




You can also use TOKENS by using Replacement patterns for PDF file  path name