Topic on Project:Support desk

Images red link use size instead of filename

8
TulipVorlax (talkcontribs)

I searched about it before starting this, but i can't find any explanation why when an image doesn't exist on the wiki yet and the code specifiy a size for it, the text of the red link to upload it become something like "100px" or "32px". I wasn't doing this in previous version of the software...

Exemple, i have a template that construct the filename based on the pagename like this :

[[File:{{PAGENAME}} - logo.png|32px]]

It result in a 32px red link instead of the name of the file. I think that users will be confused and don't understand what file to upload. Maybe there isn't many wikis that like having red links to files before they gets uploaded, but i have an history on gamming wikis where it's the way we do things. On thoses, most pages have an infobox with an image (or two) that the creator of the page dont necessarly have at had with creating the page. And i have an history with french wikis where the contributors number is really low and where passing by users dont know wikis much, and a 180px red link wont tell them they can upload a picture of... the thing wich the page is talking about.

Why im telling all this is because i went to several others wikis to test this an it produce the same result so for me it's the software that one day becamed a tad silly about this. I think most people didn't see this as been bad in any way because they might be uploading their images by the name they want and filling in that information into the infobox instead of having the template auto generating link and uploading later or letter other upload later. I'm also aware that on some wikis the infoboxes show a temporary image instead, but i dont like it much. I think it's harder on the wiki to use "#ifexist:" on the constructed filename. Ok, that is because i insist on having the name of the file autoconstructed, for me it's just logical. I can explain why more lenghtly if needed.

Thanks.

Bawolff (talkcontribs)

It becomes 32px becuase if the image isn't there its treated as a normal link - you can use variables like {{PAGENAME}} in #ifexists.

What do you think the ideal behaviour should be instead?

Krinkle (talkcontribs)

I agree with TulipVorlax.

There is two ways of linking to files. For files the default [[bracket]] notation will attempt to embed the file, and the [[:colon bracket]] is for linking to the file description page.

I would expect that the embedding syntax will fallback to something that makes sense for the embedding syntax, not something that makes sense in the description-page-link syntax.

Right now attempting to embed a file (or embedding a file that would be deleted tomorrow) would result in the second pipe-parameter being used as linktext, which doesn't make any sense for the embed-syntax.

Examples:

  • Embed syntax, image exists: [[File:Example.jpg|20px]]
  • Link syntax, image exists: [[:File:Example.jpg|more info about image]]
    more info about image
  • Embed syntax, image doesn't exists: [[File:Something else random.jpg|20px]]
  • Link syntax, image doesn't exists: [[:File:Something else random.jpg|more info about image]]
    more info about image

As of writing this generates:

  • Thumnail embed
  • Link to page "File:Example.jpg" with link text "more info about image"
  • Link to url "//www.mediawiki.org/w/index.php?title=Special:Upload&wpDestFile=Something_else_random.jpg" with link text "20px"
  • Link to url "//www.mediawiki.org/w/index.php?title=File:Something_else_random.jpg&action=edit&redlink=1" with link text "more info about image"

The third one is wrong

TulipVorlax (talkcontribs)

It's sure that i can live with it, for now. My new project is something i'm starting up and if Google already know about it, almost nobody know about it. It's like the resurrection of a project that i had when i was on Wikia but with a small twist. It's not exactly the same.

What i think about the red 20px links is that it sould be something else. Anything whould be better. But if i must choose, i would make it go back the way it was before, putting the name of the destination file as a red link. I would gracefully accomodate myself with an extension that would do this instead of a global change to the software. Sadly, i'm not a good enough PHP coder.

Thanks.

Subfader (talkcontribs)

I talked to the devs on IRC about it and I doubt this will be changed.

TulipVorlax (talkcontribs)

Thanks for trying. Maybe someday someone would come up with an extension for this but it seems unlikely.

Bawolff (talkcontribs)

Well as a quick hack, add the following to the bottom of your LocalSettings.php:

$wgHooks['ParserMakeImageParams'][] = 'wfFixMissingImageLink';
function wfFixMissingImageLink( $title, $file, &$params ) {
        if ( !$file && $title ) {
                # File doesn't exist. (Page could potentially though)
                $newTextForImgLink = $title->getFullText(); # Full name of page.
                # Alternatively could be something like 
                # $newTextForImgLink = 'Upload ' . $title->getText();
                $params['frame']['title'] = $newTextForImgLink;
        }
        return true;
}

(That won't change things for situations like the image is on bad image list, the page name is prefixed with a colon, or image doesn't have a media handler.)


I do agree that we should handle this situation better in core.

TulipVorlax (talkcontribs)

Oh wow ! Thanks a real lot ! It work !
Sorry for not having returned here sooner. I got a warning about a new mediawiki version and was trying to get the full release notes (the link on main page point to a page with a broken link) when i saw that i had a new message.
Looking at that code it seems so easy but i would have never been able to do it myself.

Reply to "Images red link use size instead of filename"