Join two files like href and img src in HTML by means of Wiki markup?
Fragment of a discussion from Project:Support desk
I don't think it gets better than what you're suggesting in the end. Two links with {{filepath:}} to generate an external link and feed it to the |link= parameter of the first link.
If you need this in many places you could create a template:
Template:PdfLink:
[[File:Farm-Fresh_file_extension_pdf.png|link={{filepath:{{{1|Example.png}}}}}]][[Media:{{{1|Example.png}}}|{{{2|{{{1|Example.png}}}}}}]]
And use {{PdfLink|Python_Programming.pdf|Python Programming}} to create:
Krinkle, thank you for your help. Admittedly it isn't exactly what I expected, namely one link like in HTML:
<a href="http://upload.wikimedia.org/wikipedia/commons/9/91/Python_Programming.pdf"> <img src="http://upload.wikimedia.org/wikipedia/commons/8/84/Farm-Fresh_file_extension_pdf.png" />Python Programming</a>
But your solution is also cool. I've created a "PDFLink" template according to your idea, and it works great. Thanks!