Gillian
Gillian

Reputation: 81

How does MediaWiki calculate the file path to an image?

I'm just installing MediaWiki (loving it). I'm lookin at this for adding images. I can se the logic of

[[File:MediaWiki:Image sample|50px]]

but where so I set the filepath for "File" (nothing obvious in LocalSettings.php) ... or is there some other logic at work?

I'd appreciate any help Thanks

Upvotes: 8

Views: 3977

Answers (4)

Rob Holland
Rob Holland

Reputation: 13

Just for future reference in case someone else runs into this issue:

I installed MediaWiki on my Mac OS Sierra and when I attempted to upload an image I got the following message:

Failed:
Could not open lock file for "mwstore://local-backend/local-public/d/d9/babypicture.png".

I changed the permissions on the mediawiki_root/images folder to be owned by _www user and group.

chown -R _www:_www wiki/images

I was able to upload the image afterward.

Upvotes: 0

Tgr
Tgr

Reputation: 28160

File location is determined by $wgLocalFileRepo which by default depends on $wgUploadDirectory and $wgHashedUploadDirectory. The upload directory defaults to [MediaWiki base dir]/images (Adrian must be using an older version). If hashing is enabled, /x/xy will be appended to the path, where xy are the first two letters of the md5 hash of the filename.

Upvotes: 11

Adrian Archer
Adrian Archer

Reputation: 2323

The defaults from DefaultSettings.php are:

$wgUploadPath = "$wgScriptPath/uploads";
$wgUploadDirectory = "$IP/uploads";

If you want to change this, you should copy and paste this into LocalSettings.php

And make sure that $wgEnableUploads = true; is in LocalSettings.php too.

Upvotes: 1

scaryzet
scaryzet

Reputation: 923

Your "Image sample" is the name of image, not the name of a file. By config file you can just set the root folder for image uploads.

Upvotes: 0

Related Questions