[Mediawiki-l] Image as a link

Erik Moeller erik_moeller at gmx.de
Mon Feb 20 11:21:18 UTC 2006


Andrew Barnett:
> Hi Everyone,
> 
> I'm curious as to whether there is a way to create a banner for a 
> particular page on my wiki and then have that link directly to the 
> advertising website rather than the image page.

There's a couple of weird hacks that work. You can use an absolute link 
pointing to an image as text, like so:

[http://mywiki.com/wiki/My_page http://mywiki.com/upload/a/bc/myimage.jpg]

Wrap it in <span class="plainlinks"> to get rid of the link arrow, or 
use this as a template:

<span class="plainlinks">[{{SERVER}}{{localurl:{{{1}}}}} {{{2}}}]</span>

Pass the page name as the first parameter and the image absolute URL as 
the second one. $wgAllowExternalImages needs to be enabled for this to work.

The second hack is CSS-based and can be found at:
http://en.wikipedia.org/wiki/Template%3AClick

It's used on Wikipedia but doesn't work in all browsers.

Finally, there's an extension here:
http://leuksman.com/extensions/ImageLink.phps

Haven't tested that one, though.

10 brownie points for anyone making a nice FAQ entry out of this response.

Erik



More information about the MediaWiki-l mailing list