0

I have a content type, which has video and image attachment. In the view created on this content type, the table shows the thumbnails of video and image file. I want to link thumbnails to files/fileid. And not sites/all/default/files/filename....I want to link to file-id and not generic file... Tried rewrite results as a link but the lin there doesn't supports the tokens (file:fid or file:filename)..

  • Here is a weird little views tip regarding what shows up in the tokens. If you add file:fid or file:filename under the fields section of views and place it above the field you are trying to call the token on it will likely show up. The replacement values (if they are connected) will be generated by having the fields earlier on in the list. Might be worth a try. – Shawn Matthews May 1 '17 at 17:31
0

Adding a field above the field in the list doesnt works because, he has build content on content type that has attachment, and not mere files..Means the view is not build on files so it will not have the field file:filename or file:fid... The best solution is to use custom formatter module {https://www.drupal.org/project/custom_formatters} and in that use html plus tokens with following code

<a href="/?q=file/[file:fid]/"><img src="[formatted_field-image:image_url:image_style-media_thumbnail]" alt="[field_property:alt]" title="[field_property:title]" /></a> 

This will give the required link to the thumbnail, if you dont want thumbnail you can put text there....

and then in views select the custom formatter for the required image field...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.