Project:Support desk

About this board

Welcome to the MediaWiki Support desk, where you can ask MediaWiki questions!

(Read this message in a different language)

See also

Other places to ask for help:

Before you post

Post a new question

  1. To help us answer your questions, please indicate which versions you are using, as found on your wiki's Special:Version page:
    • MediaWiki version
    • PHP version
    • Database type and version
  2. Please include the web address (URL) to your wiki if possible. It's often easier for us to identify the source of the problem if we can see the error directly.
  3. To start a new thread, click "Start a new topic".

Creating thumbnails for multiple files

14
Jonathan3 (talkcontribs)

On my old server, MediaWiki couldn't create thumbnails for PDFs. I never got the bottom of why it didn't work. Anyway, now, on a new server, it can. When I purge a File: page, usually it's able to create a thumbnail. How could I go about creating thumbnails for all files (or all files which currently have no thumbnail)?

Would I be able to use Manual:purgeList.php - and is there anything I should watch out for?

Thank you.

Bawolff (talkcontribs)

I would suggest scripting requests to thumb.php


If you're not using a 404 handler, running refreshLinks.php might be a good option for thumbs in pages (but not the preview link on the image description page)


I think purgeList only does cdn purges, which is wrong type of purge for this

Jonathan3 (talkcontribs)

I've had a look at Manual:Thumb.php. I don't fully understand that part about 404 handlers.

I only have about 100 or so files that I think will need thumbnails created, so don't think complicated code would be worthwhile. Especially as I'll be identifying the files manually. If I were to just create a list of links like

https://example.com/w/thumb.php?f=Filename.pdf

and just click on each of them, would that do the job?

Bawolff (talkcontribs)

you would have to specify the width you want as the w parameter.

Jonathan3 (talkcontribs)

Most of my PDFs are A4 size and the File: page says something like:

Size of this JPG preview of this PDF file: 424 × 600 pixels. Other resolution: 170 × 240 pixels.
Original file ‎(1,240 × 1,754 pixels, file size: 60 KB, MIME type: application/pdf, 2 pages)

It seems that the File: page uses the 424-wide one for the current page, and the 170-wide one for the previous/next page.

And when used on a wiki page with [[File:...]], judging from the quality, it's the 424-wide one being used.

Should I run thumb.php for both widths? Or can it only create one thumbnail per file?

I could just try it out rather than asking, but don't want to mess anything up!

Thanks.

Jonathan3 (talkcontribs)

Thinking about it - it might be as easy just to visit each File: page and purge it :-)

Jonathan3 (talkcontribs)

When I go to example.com/thumb.php?f=Filename.pdf&w=424 I get the error:

Error generating thumbnail
Error creating thumbnail: No path supplied in thumbnail object

What should I do? Thanks.

Bawolff (talkcontribs)
Jonathan3 (talkcontribs)

I tried that on one file and then the thumb.php URL again, but got the same error message.

sudo php refreshImageMetadata.php --start="Filename.pdf" --end="Filename.pdf" --verbose --force
[sudo] password for ...:
Processing next 1 row(s) starting with Filename.pdf.
Forcibly refreshed File:Filename.pdf.

Finished refreshing file metadata for 1 files. 0 needed to be refreshed, 1 did not need to be but were refreshed anyways, and 0 refreshes were suspicious.

The File: page still shows the PDF as having 0x0 pixels. It wasn't one of those PDFs that thumbnails don't work for, as purging the wiki File: page created the thumbnail all right.

Jonathan3 (talkcontribs)
Bawolff (talkcontribs)

> i thought Manual:purgeList.php might work. It's supposed to be the same as &action=purge (see here). But again it didn't create a thumbnail.

Its not, it does only varnish purging not other types.

Jonathan3 (talkcontribs)

Sorry - I meant to type "I thought Manual:PurgePage.php might work."

I knew from your previous comment that purgeList.php wouldn't work (though I tried it out of curiosity...)

Bawolff (talkcontribs)

oh, that script is new. I hadn't heard of it before. Sounds like it would work.

I suspect the main problem is the metadata is claiming that the file is 0x0 dimensions which makes it impossible to thumbnail. Purging causes it to reread the meatadata and get the correct dimensions.

Jonathan3 (talkcontribs)

I realised from a comment of Bawolff's on a different topic that it's Extension:PdfHandler rather than MediaWiki that creates thumbnails for PDF files (which is what I'm dealing with here). Though I suppose that extension might hook into MediaWiki code so maybe generic MediaWiki scripts should now work for PDFs.

Anyway, I checked the talk page there and saw that someone had asked "How to create thumbnails of all existing PDF files?" 5 months ago (Topic:Vy98ku0kdjuq3nrw)... and that the person was me...... unfortunately there was no reply.

Reply to "Creating thumbnails for multiple files"

Class 'SkinChameleon' not found

2
Widetest (talkcontribs)

I have a problem updating the mediawiki version. Indeed I installed mediawiki 1.31.14 with BlueuSpice 3.2.1. I integrated Semantic Mediawiki version 3.1.6, everything goes very well, but once I have updated the system with "maintenance / update", the application does not start anymore and displays the message:

Fatal error: Uncaught Error: Class 'SkinChameleon' not found in /home/xxxxxx/example.com/skins/BlueSpiceCalumma/src/Skin.php:11.

If there is anyone who can help me i will be very happy

Osnard (talkcontribs)
Reply to "Class 'SkinChameleon' not found"

Change the interface language for anonymous via JavaScript

1
Spas.Z.Spasov (talkcontribs)

Hello,

I'm tring to create a script that changes the MediaWiki interface language via javascript based on the page language.

For logged-in users I'm able to do that by changing the user's options via an API request as shown below, but this do not work for anonymous users. So my question is: Is it possible to change the interface language for anonymous via JavaScript? And how do I do that?

/**
 * Automatic switch of wgUserLanguage, based on wgPageContentLanguage
 * The output of Template:AutoLangSwitch (id='auto-lang-switch') is a triger
**/
( function ( $, mw ) {
	mw.loader.using( 'mw.Api' ).then( function () {
		var nSspaceN = mw.config.get( 'wgNamespaceNumber' );
		var lgAction = mw.config.get( 'wgAction' );
		var pageLang = mw.config.get( 'wgPageContentLanguage' );
		var userLang = mw.config.get( 'wgUserLanguage' );
		var langTest = document.getElementById( 'auto-lang-switch' );
		
		if ( pageLang !== userLang && lgAction === 'view' && nSspaceN === 0 && langTest ) {
			var params = {
				action: 'options',
				change: 'language=' + pageLang,
				format: 'json'
			},
			api = new mw.Api();
			api.postWithToken( 'csrf', params ).done( function ( data ) {
				console.log( data );
			} );
			location.reload();
		}
	} );
}( jQuery, mediaWiki ) );
Reply to "Change the interface language for anonymous via JavaScript"
109.187.176.241 (talkcontribs)

Через МФЦ поступило личное дело, введено и к нему ошибочно прикреплено личное дело другого безработного. Каким образом "разъединить " эти два дела?

Reply to "Личное дело"

Is there any difference for icons?

2
Аргскригициониец (talkcontribs)

This wiki uses complex template for icons like: {{icon|opinion}} {{icon|state religion happiness}} etc. Page of icon template

On my wiki I use a simplified way: I just create a new template for each new icon like {{opinion}} ((state-religion}} etc.

Is there any difference in these methods if I speak about perfomance? There can be more than 100+ icons on a page, so I wonder if my method is overloading or there is no any difference apart from convenience.

Bawolff (talkcontribs)

Its unlikely that there is a performance difference, or if there is, its probably to small to notice.

Note: If you are using instantcommons, there is known performance issues with that feature when you have a large number of images on a page.

Reply to "Is there any difference for icons?"

Replacing all file uses with another file

3
NilsTycho (talkcontribs)
Ammarpad (talkcontribs)

I think File-movers (or Admins?) on Commons have access to a script that can do this globally. You should request for that there. If you want do it yourself, I guess you've to do that manually.

Zabe (talkcontribs)
Reply to "Replacing all file uses with another file"

How to show a little file thumbnail image, for a download?

7
RedKnight7 (talkcontribs)

I want to post an Excel and a PDF for folks to download from my tiny wiki. I can make hotlinked text for users to click on and download the Excel or the PDF, using a Media: link. But I would like to do this with a generic little Excel thumbnail image or a generic little PDF thumbnail image for the user to click on, instead of text saying "here's the Excel", etc.

I imagine this is pretty easy but I don't know what keyword to search on, to find out how to do it.

Also, would I have to make or supply my own little Excel and PDF images, to use for this?

Ciencia Al Poder (talkcontribs)

The easy way is to upload a thumbnail of the Excel/PDF to your wiki, and then make the thumbnail link to the download.

Example:

[[File:ExcelThumbnail.png|80px|link=Media:My excel file.xlsx|Download]]

You can even put that code inside a template, making the link= value a parameter, for easy usage.

RedKnight7 (talkcontribs)

Thanks very much! It all works okay except if I put something like:

[[File:Excel_icon.gif|80px|link=Media:Spreadsheet_data.xlsx|right| Excel of electricity by month]]

It does everything else right (showing a linked icon on right side of page), but there are two problems:

1) If you click on the image , it doesn't go directly to the "download xls to where?" popup, instead it goes to the actual File: page for that file on my wiki. And then the person has to go through a few more clicks to actually download it.

2) It does not show the caption text "Excel of electricity by month" at all.

Thanks so much if you can help. Coding is such a hassle, laugh.

I have MediaWiki 1.35.1

Ciencia Al Poder (talkcontribs)

Oh, well, looks like we've hit bug phab:T18409.

You may try to change the link Media:Spreadsheet_data.xlsx to Special:FilePath/Spreadsheet_data.xlsx

If you want to display a caption, add |thumb|

Jonathan3 (talkcontribs)

I was just working this out yesterday (using images as links) and came across the same problem - it links to the File: page instead of the actual uploaded file.

Anyway, you want something like this in your template, where {{{Download|}}} is the filename and {{{Caption|}}} is the caption text:

[[File:{{{Download}}} | thumb | link={{SERVER}}/media/{{urlencode:{{{Download}}}|WIKI}} | {{{Caption|}}} ]]

If your URL structure has /images/ (I think I changed mine a few years ago but can't remember) then just change that part of the line above. {{SERVER}} should turn into (e.g.) https://www.example.com, or alternatively you can just put the URL into the template if it's never going to change. {{urlencode:...|WIKI}} changes spaces to underscores (so that the link will work) etc.

With the caption problem, some methods of displaying images just don't show the caption. It's all here: Help:Images. If you use |frame or |thumb (as Ciencia said) the caption will show up.

RedKnight7 (talkcontribs)

Thank you everyone, It was hard for me to read the {{{}}} stuff. So if it helps any, this is what worked for me:

[[File:Excel_icon.gif|150px|left|link=http://YourWebsiteName.com/wiki/images/1/15/Your_Great_Spreadsheet.xlsx|thumb|Spreadsheet of electricity usage by month]] 

Problem solved. Love you folks. Ciencia, you've been helping for years!

Bawolff (talkcontribs)
Reply to "How to show a little file thumbnail image, for a download?"
Kanasalaatti (talkcontribs)

Now I also have a problem with wikifamily that GlobalCssJs extension not work. Or that it is installed and it also reads the page Special:Version, but it doesn't seem to have an effect. If it had an effect, I could create my own global.js and global.css file on the wiki, and that same script will work on all my wikis. I think it's configured correctly (Github commit line), but it just doesn't work properly for some reason. Other similar extensions such as GlobalUserPage do work normally.

Bawolff (talkcontribs)

the config doesn't look correct, you're mixing up the array key names with the wiki name.

Kanasalaatti (talkcontribs)

What should I do?

Mainframe98 (talkcontribs)

Where it says

	'wgGlobalCssJsConfig' => [
		'wiki' => 'metawiki',
		'source' => 'metawiki',
	],

it should say

	'wgGlobalCssJsConfig' => [
		'default' => [
			'wiki' => 'metawiki',
			'source' => 'metawiki',
		],
	],

You should also fix wgResourceLoaderSources to

	'wgResourceLoaderSources' => [
		'default' => [
			'apiScript' => 'https://meta.maamedia.org/api.php', 
			'loadScript' => 'https://meta.maamedia.org/load.php'
		],
	],

Or it won't work.

But really this isn't wiki specific, and should probably go into your GlobalConfig file.

Kanasalaatti (talkcontribs)

Working, thanks!

Reply to "GlobalCssJs"

Is there any way to delete all Wikibase entries?

4
2001:8F8:146D:1C00:BD7D:F814:60B7:1B86 (talkcontribs)

Hello all,

Is there any way to delete all Wikibase entries? something like (SQL command or similar)

Thank you

Ciencia Al Poder (talkcontribs)
2001:8F8:146D:1C00:BD7D:F814:60B7:1B86 (talkcontribs)

no answer there..

Ciencia Al Poder (talkcontribs)

Correct, I was just pointing to that place just in case someone replies there, to avoid having duplicate efforts

Reply to "Is there any way to delete all Wikibase entries?"
VSN-Herman (talkcontribs)

Day All, when I check the site vsn-nederland.nl with for example Bing, I get: "The inspected URL is a redirect and cannot be indexed by Bing". Then when I check the redirection I get: "Meta description tag missing".

Does anyone know how I can solve this ?

I can't find an html file anywhere to modify the headers in ?


MediaWiki 1.34.4

PHP 7.4.16 (litespeed)

MariaDB 10.3.28-MariaDB-log-cll-lve

ICU 64.2


Hope 1 of you knows advice.

Kind regards

Jonathan3 (talkcontribs)
VSN-Herman (talkcontribs)

I tried that, but it gives the same result

Bawolff (talkcontribs)

i dont think search engines use meta descriptions anymore.

VSN-Herman (talkcontribs)

That's also an answer, but ... let's just assume that I'm really curious about this and assume that there will be a solution after all.

Or am I asking too much ?

Where can I adjust the headers ? (That's what I'm curious about ;-) At most sites in html, but where can I find that file ?)

Jonathan3 (talkcontribs)

I'd be interested to see what tests you're referring to - could you share links here?

I wonder if it's possible to avoid example.com changing to example.com/Main_Page (but still serve the Main Page) - maybe some ideas here: Manual:Short URL/Apache?

Extension:WikiSEO lets you add meta tags like description.

VSN-Herman (talkcontribs)

First, of course, you are completely free to test the site vsn-nederland.nl with whatever site tester you want. With Nibbler the site gets an overall score of 7.2 , which is not bad at all. Just think of me as someone who came out of Formula 1 and still wants better scores.

The suggestions you made are certainly interesting, well worth looking into. The Extension:WikiSEO I would like to install, while I understand that it is for version 1.35 and higher and can't find the version for 1.34. (Which of course could be just me !)

Ps.

As long as version 1.35 and up doesn't work with all browsers I'm not going to update.

Jonathan3 (talkcontribs)

With WikiSEO I'm using v1.2.1 with MW 1.34 and I see there's a 1.2.1 tag you could use if downloading using git.

Could you tell me about 1.35 and browsers? I am on the verge of upgrading from 1.34 to 1.35 as I think finally most of the extensions/skins I use are now compatible.

VSN-Herman (talkcontribs)

Okay, thanks, I'll definitely try.

About 1.35 and browsers I posted an issue under Problem with chromium/webkit browsers and login.

It may be that the display problem has been fixed with an update to MW version 1.35.2. I don't know ... I have not been able to try it out yet because the host has to change a setting first: "php-proc-get-status ON (detected: OFF)". (As long as on off an update is not accepted by Installatron).

I hope it will happen next week.

Reply to "Meta description missing"