2

I run my own MediaWiki, with file uploads disabled, but I want to put an image in there. I've tried:

[[File:image_filename.png]]

But wherever I put image_filename.png it doesn't seem to be right. I can put it there via FTP, I just need to know where the bloody thing goes.

How do I do it, which folder should the image go in?

1

If you want it from FTP upload it in the main folder and for the image type

<img src="image_name.jpg>
  • Assuming you are allowed to add img src tags to pages. – Olli Mar 2 '11 at 8:30
  • @Oli I am sure you can. – Benny Mar 2 '11 at 8:31
  • Unfortunately <img> is not allowed - I could presumably add it to the tag whitelist, but I don't want users linking in any images they like. :( – Colen Mar 2 '11 at 17:37
  • @Colen There is a whitelist that you can populate to limit websites that you can pull images from. – Hydra Jan 1 '13 at 14:36
1

Add the following lines to your LocalSettings.php file:

$wgGroupPermissions['user']['upload'] = false;

$wgGroupPermissions['uploadaccess']['upload'] = true;

Then REMOVE the following line from LocalSettings.php:

$wgEnableUploads = false;

Then add your admin account to the uploadaccess group. I have done this to my own MediaWiki page.

0

By default images get put in tree of directories, two levels deep, with two very short seemingly random directory names. See this in action e.g. this image on the commons wiki (Note the /1/1c directories in the path)

Actually it's not random. It's hashed. I think if you name your file image_filename.png then MediaWiki will expect to find this at images/5/55/image_filename.png

I say that because the md5 hash of "image_filename.png" begins with "55". You can read about how this works in the mediawiki docs about $wgHashedUploadDirectory.

So you could try FTPing them there, but this seems a bit of a messy solution.

If you set the config setting $wgHashedUploadDirectory=false then files will have a more straightforward location images/image_filename.png so that could be worth a try. Actually I think the hashing thing is to help wikis cope with gazzilions of images, so not really needed for most new MediaWiki deployments.

However you should also note that MediaWiki will try to generate thumbnails at various sizes. It will do this for display on your page if you specify a display width, but also for special views such as "gallery of files".

So all said and done, you might find it easier to enable file uploads, perhaps temporarily, or just for the sysop users.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.