select its name on the wiki, which, by default, is the file’s name on the local system. You can also provide a summary of the file, and finally you are asked to specify a copyright type for that file, based on the set of allowed copyrights for the wiki (more on this later). The copyright choice assumes that the person doing the uploading was responsible for generating the file; or, at the very least, knows the copyright wishes of the person who generated the file — and often, neither of these is the case. This book will not get into issues of copyright, legal or otherwise; but you should know that there are a lot of options for allowed copyright type, and the best solution may depend on a variety of circumstances, including whether the wiki is public or private.
Once a file is uploaded, several things happen: the file gets placed in the wiki’s /images directory (the directory is called “images”, even though it can hold uploaded files of all types); a page in the “File:” namespace is created for that file (the full name of the page will be “File: page-name ”, like “File:Cat.png”); and, if it’s an image, and the image is bigger than the standard thumbnail size, a thumbnail is created for that file and is placed in the directory
/images/thumb
.
The /images directory
The
/images
directory can take two structures. By default, the directory is subdivided into two levels of subdirectories, where the first level consists of folders whose name is a single hexadecimal digit, from “0” to “f”; and the second level has folder names whose name consists of the parent folder’s number or letter, plus a second hexadecimal digit. In other words, a file can be placed in a directory like “
/images/8/8b
” within the MediaWiki directory. There are 16 * 16 = 256 such possible sub-subdirectories. This default approach is also known as the “hashed” approach. It is used to try to prevent directories from getting too large — some file systems have a limit on the number of files any one directory can contain.
The other approach is to simply store every file in the /images directory. This approach has the advantage of simplicity, and for smaller wikis it’s just as good a solution. To enable this approach, add the following to LocalSettings.php:
$wgEnableHashedUploads = false;
If you’re going to use this setting, you should ideally do it before any files are uploaded. If, however, you want to change this setting for a wiki that already has uploaded files, you’ll probably have to re-import the files (see here ).
Thumbnails
A thumbnail is a small image meant to represent an uploaded file. For files that are images, these are simply smaller versions of the original image (or, for images that are already small, versions of the same size). For non-image files, these tend to just be an icon: for PDF files, for instance, it’s the Adobe Acrobat logo.
Thumbnails are used to represent images in various places within the wiki. Most importantly, they can be used to display the image on wiki pages -- we’ll get to the syntax and options for displaying images later in this chapter. Thumbnails are also used to show the version history of each file, within its own page. They are also used in the Special:ListFiles page (see here ), in image galleries, and in category pages, and they’re used when querying images in Semantic MediaWiki, with formats such as "table" and "gallery" (see here and here , respectively).
Troubleshooting uploading
It could be that, when you try to upload files on a wiki, you’re not allowed to. That could be for any of the following reasons:
PHP on the server is blocking uploads
The /images directory is not writable by MediaWiki
MediaWiki itself has uploading disabled
your user account is not allowed to upload.
If it looks like PHP is blocking uploads, add the following line in php.ini:
file_uploads = On
If the images directory is not writable, the solution depends on the web server and
Lynsay Sands
Sophie Stern
Karen Harbaugh
John C. Wohlstetter
Ann Cleeves
Laura Lippman
BWWM Club, Tyra Small
Charlene Weir
Madison Daniel
Matt Christopher