User talk:CharlesC/Template for navigational images on Mediawiki websites

From Meta, a Wikimedia project coordination wiki
Jump to navigation Jump to search

IE whitespace when used in a table[edit]

I'm finding your Clickpic template very useful in my wiki instance, but I'm running into a CSS problem when using it inside a table. In The Fox it looks great, but the a.external "correction" for IE in the CSS fixes (the correction is 13px) adds 13px of whitespace to every cell containing a Clickpic reference. I can't change that 13px padding to 0px, because that screws up how external links are displayed.

Please let me know if I'm not being clear enough, I can try to include a screenshot or two.

Any idea what I might try to fix this?

--CapaJC

Glad you find it useful! This should cure the problem:
Go to http://<your wiki address>/index.php/MediaWiki:Monobook.css and add this code:
#bodyContent .plainlinks a {
    background: none !important;
    padding: 0;
}
Do tell me if this cures it.
BTW if you embed files in your wiki you may be interesed in my Template for document links showing file icons
CharlesC 12:09, 23 April 2006 (UTC)
This worked brilliantly for me (see DUcollab running MediWiki 1.5.7). I had been tearing my hair out on this -- thank you!! --Joakim 22:26, 23 April 2007 (UTC)
Thanks for the suggestion. Before reading it, I actually found another way that worked for me. Adding the following code to IE60Fixes.css did it:
#bodyContent .plainlinks a {
    background: none !important;
    padding-right: 0px;
}
Strangely, the exact same code was already in /skins/Monobook/main.css, so I'm not sure why IE wasn't using it.
CapaJC 16:00, 24 April 2006 (UTC)

Tooltips or hints[edit]

A fantastic addition (for me, at least :) would be the ability to add a tooltip to an Clickpic image link. Again, thanks in general for this template.

--CapaJC

Not sure how possible this is. I think the label that is shown on mouse-over of the link is partly determined by the browser, as Firefox and IE (or at least IE7) show different tooltips. FF shows the address of the target file, and IE seems to show the path of the image itself. I think a more fundemental re-write of underlying mediawiki scripts is necessary to get tooltips to work as desired I'm afraid. - CharlesC 12:13, 23 April 2006 (UTC)


That was I was afraid of :( I've started digging through /includes/parser.php, but I don't think I'm enough of a coder to make it fly. We'll see, tho. If I can kluge something together, I'll let you know, but it'd probably involve changing the way external links are parsed...which I think isn't exactly a good idea.
CapaJC 16:03, 24 April 2006 (UTC)

Getting the image path[edit]

I've tried to use the 'clickpic' template described in

http://meta.wikimedia.org/wiki/User:CharlesC/Template_for_navigational_images_on_Mediawiki_websites

Does anybody have a working example of how to do it? I have done it 2 different ways and neither quite works. Method #1:

page containing the link has

{{clickpic|Main_Page|image:myimage.jpg}}

and template:clickpic has

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

In this method, the picture doesn't show up on the page. Instead the text "image:myimage.jpg" shows up. When you click the link, you go to the main page correctly.

Method #2

same as above except page containing the link has

{{clickpic|Main_Page|[[image:myimage.jpg]]}}

with the extra square brackets. This time the image shows up correctly, but when you click the image it doesn't go to the right place. It goes to the page with info about myimage.jpg.

Does anybody know how to get this working? Thanks.

Hi Mitch, you must carefully read the section "If you want to use an image that is contained within the wiki" for linking to an image. Let me know if you still have problems. --CharlesC 11:27, 11 May 2006 (UTC)


Thanks Charles. That worked. The code is something like this: {{clickpic|Main_Page|http://myserver/mediawiki/images/3/32/myimage.jpg}} mgart May 11 2006
Exactly. I've updated the page with an example to hopefully make it clearer to others. --CharlesC 12:07, 11 May 2006 (UTC)

Text link appears instead of image[edit]

I am having what seems like the same problem even after correcting my code as you've explained above.

My clickpic template looks like this:

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

and the page containing the link has this:

{{clickpic|Template:Today%27s_featured_article|http://www.imaginopedia.com/images/7/7c/Tfa_edit.gif}}

Instead of seeing my image, Tfa_edit.gif linking to the right article, I see a link called "http://www.imaginopedia/images/7/7c/Tfa_edit.gif" that points to the article.

The linking to the article is happening correctly but the image is not appearing as the linking object.

What did I miss?

The call to clickpic is inside a table header. Could that be causing a problem?

The whole mess is here http://www.imaginopedia.com/index.php?title=Test_Page mmcneal76 March 9, 2007

Actually this seems to be a different problem. I have recently added some notes on the article page explaining what to do. Please see the notes in italics in this section: here. For 'clickpic' to work you have to switch on a function within your wiki that used to be on by default on a fresh Mediawiki installation, but unfortunately now seems not to be. CharlesC 18:19, 16 March 2007 (UTC)

Expand image icon[edit]

I am making our mediawiki more image orientated for our special needs students who naturally click on images to goto pages and ofcourse we know that this takes the user to the image page, Do not like the redirect thing so decided to use your clickpic template but I wanted it to look like the rest of our current ones that use this code:

=== [[Image:AutumnIrchesterCountryPark.png|thumb|left|400px|[[Portal:Art Gallery|Art Gallery]]]] ===

by making my own version of the clickpic template based on the clickpic described on the user page:

<h3> <div class="thumb tleft"> <div class="thumbcaption"> <span class="plainlinks">[{{SERVER}}{{localurl:{{{1}}}}} {{{2}}}]
<P align="left">[{{SERVER}}{{localurl:{{{1}}}}} {{{3}}}]</P></span> </div> </div> </h3>

and calling it using:-

{{clickpic|Portal:Art_Gallery|http://www.hinwickhall.ac.uk/wiki/images/thumb/0/0b/AutumnIrchesterCountryPark.png/400px-AutumnIrchesterCountryPark.png|Art Gallery}}

Nearly got it going but would dearly like to have the expand image icon that actually does take the user to the image page but was wandering the best way to get the expand icon to appear by not using absolute http://... utl?

The other problem is that I cannot seem to use the clickpic within a table. Is it possible?

Hope I have not asked this in wrong place.

Nexus6 21:30, 5 May 2006 (UTC)

Replicating the small icon at the bottom right that then takes you to the image page can be done, but you will have to alter the template so it takes a third parameter which is the title of image page. Unfortunately I don't think it can be done without giving both the absolute path to the image and it's image page title. Within the template you will have to create another small clickable image to represent the expand image icon which when clicked on goes to the third parameter - i.e. the image page - in the same manner that the original clickpic template works. I hope this makes sense.
Concerning using clickpic within a table, I do not seem to have a problem with this. Are you saying your customised version of clickpic doesn't work within a table? And how doesn't it work?! --CharlesC 09:38, 12 May 2006 (UTC)

CAPTCHA[edit]

For those that use CAPTCHA:

<span class="plainlinks">[{{fullurle:{{{link}}}}} {{SERVER}}{{SCRIPTPATH}}/images/{{{imagepath}}}]</span>

--65.147.170.213 21:38, 3 August 2006 (UTC)

Linking to IP Address Instead of Hostname[edit]

--ckoester

  • The template is working for me, but my image links are linking to the IP address of the server instead of the hostname. Anyone know how to resolve this? (Pun intended)
  • FIXED - The SERVER variable in the template should automatically point to the hostname of the server. If it does not work, you need to make sure that Apache is configured properly. Specifically, you must specify ServerName in httpd.conf or you virtual host file.
  • If you cannot get Apache configured correctly, you can manually override the server setting in Mediawiki. Add the following to LocalSettings.php:
$wgServer = "hostname"