Jump to content

Kézikönyv:Képadminisztráció

From mediawiki.org
This page is a translated version of the page Manual:Image administration and the translation is 30% complete.
Outdated translations are marked like this.

Ez a cikk a MediaWiki fájlkezelését és -tárolását írja le, és néhány információt ad a konfigurálásról.

This applies to images as well as to any other type of file that can be uploaded. All files are stored with a corresponding article in the "File:" namespace. A MediaWiki 1.14 előtt a „Kép:” névtér volt használatban. A „Kép:” a visszafelé kompatibilitás végett használatban maradt.

Képfeltöltés és -használat

Lásd: Help:Képek

Enable upload of images

To upload files, these conditions have to be met:

  1. MediaWiki must have uploads enabled.

Állítsd be a $wgEnableUploads értéket true-re.

  1. The file type must be allowed.

More information: $wgFileExtensions .

  1. The user must be in a group with the "upload" right.

By default this is given to all logged-in users.

Uploads are done using Special:Upload.

Lásd: Manual:Configuring file uploads , Manual:MIME type detection és Manual:Adding support for new filetypes

Relevant parameters for file handling

These parameters are relevant:

Image thumbnailing

MediaWiki's image syntax allows dynamic resizing and thumbnailing of images (see Manual:Configuring file uploads for general help on file uploads).

Image thumbnailing requires either ImageMagick or GD library – neither are part of the default MediaWiki installation.

GD

PHP comes with GD graphics library enabled by default. GD will not require any configuration or modification to be used.

Windowson ajánlott a GD használata.

A GD innen tölthető le: https://libgd.github.io/. Újabb PHP-verzióknál nem szükséges ez.

ImageMagick

A MediaWikiben engedélyezd a LocalSettings.php-ben az ImageMagicket a $wgUseImageMagick true értékre állításával.

Az ImageMagick innen tölthető le: https://imagemagick.org/.

Once ImageMagick is installed, you must enable ImageMagick and point MediaWiki to the convert or convert.exe program on your computer in LocalSettings.php like this:

$wgUseImageMagick = true;
#$wgImageMagickConvertCommand = 'C:/ImageMagick/convert.exe'; # for Windows
$wgImageMagickConvertCommand = '/usr/bin/convert'; # for Linux

ImageMagick használata esetén a LocalSettings.php-ban állítsd be a $wgUseImageMagick értéket true-re. Make sure that the command is executable by the web server process. For example, Windows users will want to change the default to "C:\ImageMagick\convert.exe" (or similar).

To re-create old thumbnail files before you used ImageMagick you can use $wgThumbnailEpoch .

If rendering fails silently, check and increase $wgMaxShellMemory .

See the help page on Image Thumbnails not working for troubleshooting.

A GraphicsMagick is használható az ImageMagick alternatívájaként. You will need to set $wgCustomConvertCommand to the following. E.g.:

$wgUseImageMagick = false;
$wgCustomConvertCommand = "gm convert %s -resize %wx%h %d";

Képformátumok

GIF

For thumbnailing GIF-Animations under windows, you need to install ImageMagick as described above.

SVG

Wikimania 2016 presentation on Dynamic SVG

MediaWiki supports SVG image rendering: if enabled, SVG images can be used like other image files — they will automatically be rendered as a PNG file and thumbnailed as needed on the fly. If you're on a shared host and no SVG renderer is pre-installed, you should probably ask your provider to install it for you.

To enable SVG support:

  1. Allow upload of SVG files in the LocalSettings.php file: $wgFileExtensions [] = 'svg';. Note that MediaWiki will refuse SVG files containing JavaScript, for security reasons.
  1. If you get an error saying the file is corrupt, make sure MIME type detection is working properly.
  1. Add $wgSVGConverter to LocalSettings.php and set the renderer you want to use.
  1. Elérhető opciók: ImageMagick, ImagickExt, sodipodi, inkscape, batik, rsvg és imgserv.
    Például: $wgSVGConverter = 'ImageMagick';
    • If the converter program is not in the system path, you have to specify the directory that contains the program using $wgSVGConverterPath ..
    • A librsvg gyors, de nem nagyon pontos. Sok könyvtártól függ. E könyvtárak automatikus telepítéséhez lehet, hogy használnod kell csomagkezelőt. A Wikimédia-projektek rsvg-t használnak.

Its SVG parsing is more strict, causing it to reject "almost valid" SVG files that other renderers accept (e.g. commons:File:UbuntuCoF.svg). Batik relies on Java, and is much slower than rsvg, though this may not be a huge issue unless you're constantly adding SVG files. See SVG benchmarks . Requires a lot of work to get running, if not included in your distribution.

    • Inkscape also does an accurate job of SVGs, half the speed of rsvg, but was designed for interactive graphical use; however, it comes with inkview which is a viewer/converter program – it requires a writable home directory for the user it's run as.

Since it will be running as user www or something similar, it will try to create .inkscape/ and .gnome2/ directories in the corresponding home directory, and will fail silently, crash or hang indefinitely if it is not able to. Inkscape is preferable to rsvg (a) on Windows (it comes as a standalone package) or (b) if you have important SVGs drawn in Inkscape that do not render correctly in rsvg. Inkscape has as complicated a dependency chain as librsvg — use only if it's in your distribution or available as a complete standalone package.

    • Sodipodi is the program Inkscape was forked from.

The same considerations apply. Sodipod is no longer under active development.

    • A 6.x.x verzió óta az ImageMagick SVG-t is leképez, de nem tökéletesen.
      • On Windows, $wgConvertPath must be set to avoid a conflict with Windows' own convert.exe. One simple alternative in this scenario is to add to LocalSettings.php the line $wgSVGConverters['ImageMagick'] = '"' . $wgImageMagickConvertCommand . '" -background white -thumbnail $widthx$height^! $input PNG:$output';, which also allows for spaces in the path.
      • Az ImageMagick esetén előfordulható bélyegképkészítési hibák elkerüléséhez ha 7.0.9-25 vagy újabb verziójú, az Inkscape-nek is 1.x.x-nek vagy újabb verziónak kell lennie. Ugyanígy ha az ImageMagick verziója 7.0.9-25-nél régebbi, az Inkscape-nek 1.x.x-nél régebbinek kell lennie. See ImageMagick issue.
    • A PHP Imagick kiterjesztése támogatja az SVG-leképezést, azonban ugyanazokkal a kiegészítésekkel, mint az ImageMagick.
    • The GD library is not capable of converting SVG images to the PNG format, at least according to Joen Asmussen's June 2008 NoScope blog.

Set $wgSVGConverter = false if SVG rendering is not needed and you wish to make your users download the svg file in order to view it.

Hibaelhárítás

Ha üres téglalapot (Chrome) látsz az SVG helyett, vagy egyáltalán nincs is kép (Firefox), és minden PNG-hivatkozás 404-es hibához vezet, és nem látsz más hibaüzenetet, ellenőrizd a $wgGenerateThumbnailOnParse változót. Ennek false értékre állítása az SVG-transzformációt mindig késlelteti. Make sure that proc_open and symlink PHP methods are enabled (they may be disabled in php.ini for security or performance reasons).


JPEG (GD használatával)

Simply adding the following line to LocalSettings.php will cause auto fall back to the GD library:

$wgUseImageMagick = false;

For errors with JPEG thumbnails, see JPEG (using GD).

TIFF

Generating thumbnails of TIFF files requires MediaWiki 1.15.0 or newer.

  1. Allow upload of TIFF files in the LocalSettings.php file:

$wgFileExtensions [] = 'tif';

  1. Add $wgTiffThumbnailType to LocalSettings.php and set to either jpg or png to specify which type of thumbnail you wish to have generated.
  1. Making thumbnails of TIFF files may require system resources beyond those needed for thumbnailing JPEG, GIF, or PNG files.

Consider appropriate settings for $wgMaxImageArea and $wgMaxShellMemory

DjVu


Képek törlése

Files, like wiki pages, can only be deleted by users with the lapok törlése (delete)" permission (adminisztrátorok by default). Deletion of files is done by deleting the associated description page (or by clicking the összes törlése link in the Fájltörténet table).

Deletion of individual revisions

If a file has been altered, there is a revision history of the files which is displayed on the file article page. Each revision has a törlés link. If this is clicked, the revision and the file are deleted.

The versions of files are separate from the page history of the file description page.

Information about old revisions of files are stored in the oldimage table while information on old revisions of the pages are stored in the revision table.

Fájlok helyreállítása

Files can be undeleted in exactly the same way as normal wiki pages. The directory in which deleted files are stored is defined by Kézikönyv:$wgDeletedDirectory . Information about deleted images are stored in the filearchive table.

Archivált fájlok törlése

A MediaWiki 1.11 óta a törölt képek alapértelmezés szerint megőrződnek a szerveren. Ha kiválasztott archivált képeket szeretnél törölni, megteheted a eraseArchivedFile.php karbantartószkripttel. Ha mindet törölni szeretnéd, megteheted a deleteArchivedFiles.php szkripttel. Ha archivált fájlokat törölsz, nem állíthatod helyre többé.

Fájlok törlésének okai

When choosing to delete a file, as described above, users will be asked to provide a reason for deletion. The available reasons can be edited on the MediaWiki:Filedelete-reason-dropdown of your wiki.

Modifying the display of file pages

MediaWiki:Filepage.css is a standard stylesheet which can be used to modify the display of file pages. The contents of Filepage.css will be loaded only on File namespace pages. If remote files are enabled, the remote wiki's version of this page will also load.

Adattároló

Whenever an image is uploaded, several things are created:

  1. An article in the file namespace with the name of the file, e.g. File:MyPicture.png.

This page is stored and can be edited like any other page.

  1. The file itself is stored in a folder on the file system with whitespaces merged and replaced with _.
  1. If necessary and thumbnailing is available, thumbnailed versions of the file will be created when necessary (such as for the usage on the file description page).

These are stored in the thumb directory of the image directory, in a separate directory for each main file.

If $wgHashedUploadDirectory is enabled (by default), MediaWiki creates several subdirectories in the images directory.

The directory names are from the first two characters of the md5 hash of the final filename.

Mappák

All image files are stored in a folder determined by $wgUploadPath (images/, by default).

Description of named image subfolders:

archive
This is the storage place for files that have been replaced by newer versions.
temp
Used for temporary storage of files during image uploading. (Due to task T11018, these files may not always be automatically deleted).
thumb
Thumbnails (automatically generated) for the files. If these are deleted, they are automatically regenerated when needed.

Depending on the configuration, there may be additional image subfolders:

math
Folder to store your rendered TeX input, see also Kiterjesztés:Math or Manual:Math .
x/xy
If $wgHashedUploadDirectory is set to true (which is the default), images will be stored in subfolders of the images, thus making file paths look like images/a/ab/filename.jpg. See Manual:$wgHashedUploadDirectory for more details on why this might be desired and how this system works.

Adatbázis-táblázatok

  • The file description page is stored as any page in the page, text, revision etc. tables
  • image - Holds some metadata such as the size of the file and the upload date.
  • oldimage - This stores information for files that have been replaced with newer versions.
  • filearchive - A törölt fájlok információját tartalmazza.
  • imagelinks - Records what pages use a file.

Tárhelyhasználat

Files need considerably more space than articles. Az alábbi számítások 4 KB-os blokkméretet feltételeznek Linux/Unix-szerverekkel.

Az alapértelmezett beállítás a $wgHashedUploadDirectory = true.

A könyvtárak tárhelyigényei:

  • képmappák: 0-f/x0-f: max. 16*16 = 256 könyvtár = 256*4 KB = 1024 KB
  • archívumkönyvtárak: 0-f/x0-f: max. 16*16 = 256 könyvtár = 256*4 KB = 1024 KB
  • bélyegkönyvtárak: 0-f/x0-f: max. 16*16 = 256 könyvtár = 256*4 KB = 1024 KB
  • temp directories: 0-f/x0-f: max. 16*16 = 256 directories = 256*4 KB = 1024 KB

Tehát a legkisebb mennyiségű tárhely feltöltött képek nélkül elméletileg 4 MB (de valójában a könyvtárak csak szükség esetén jönnek létre).

Fájlonként szükséges:

  • az eredeti kép mérete + 2 KB átlagos többlet

For files that need to be thumbnailed:

  • size of the created thumbnail(s) + 2 KB average overhead (each)
  • directory for thumbnail (4KB) (each image has its own thumbnail directory)

Példák:

  • image 20778 Byte png (small size, no thumb): 24 KB for the image: Total 24 KB
  • image 123.000 Byte jpeg (big size, auto thumb): 124 KB for the image, 4 KB for the thumb directory, 64KB for the thumb: Total: 192 KB

Fájlhozzáférés

Uploaded files are generally served directly by the web server, not through MediaWiki. While there may be a minimal level of security through obscurity with path encryption (e.g. /c/c4/...) if $wgHashedUploadDirectory is set, the path can be calculated easily from the file name and does not provide true protection.

For limiting access to authorized users, see Manual:Image authorization .

Upload form

Licensing

MediaWiki allows licenses to be added to files uploaded from the Special:Upload page. The list of licenses that appear in the license selection dropdown can be edited on the MediaWiki:Licenses page by a sysop.

The page should be a bulleted list of items, and can have sub-items. Each item can have one or more parameters, with the parameter separated by the pipe character (|).

To make headers/categories, use only one parameter in a list item. The text will be what appears in the dropdown list, and will appear greyed-out and unclickable.

To add license options, two or more parameters are required. The first parameter will be the template name to use, without the double square brackets. The last parameter will be what appears in the dropdown list for that license. Any additional parameters between the first and last parameters will be passed as arguments to the template. When a license is selected, a preview of what it would look like on the final page is shown in the upload wizard.

Below is a simple example (not using real templates) of how MediaWiki:Licenses should be formatted:

* no-lic|No license.
* Made by me:
** self-lic|And it can only be used on this wiki.
** self-lic|free=yes|And I allow it to be used anywhere.
* Made by someone else:
** pd-lic|It's in the public domain.
** copyright-lic|It's copyrighted.
** cc-lic|It uses some CreativeCommons license.
** cc-lic|by-sa|It uses the CC-BY-SA license.

The above assumes each template ending in "-lic" exists, where some of those templates take positional arguments such as "by-sa" and others take named arguments such as "free=yes". Selecting the "And I allow it to be used anywhere" option, for example, would add the following text to the page of the new file:

{{self-lic|free=yes}}

Sites like Wikipedia and WikiMedia Commons will also use the subst: tag, such as WikiMedia Common's usage of it below:

** subst:Template 2|flickrreview|subst:uwl|Image from Flickr and I do not know the license

"Template 2" is an actual template that will take two parameters (being template names) and surround them with double curly brackets so they get transcluded on the page of the new image. "uwl" is a template, whose documentation requires using it with the "subst:" tag instead of directly. The above will result in the following being added to the uploaded file's page:

{{flickrreview}}{{subst:uwl}}

On Wikipedia, substitution is used in other ways, such as adding a timestamp with the license at the time of upload.

For detailed real world example, see Wikipedia:MediaWiki:Licenses or Commons:MediaWiki:Licenses.

Foreign Repositories

It is possible to access files stored in foreign repositories, without needing to upload them to the wiki, by setting the $wgForeignFileRepos array. This feature offers several possibilities:

  • ForeignAPIRepo accesses files from a remote MediaWiki installation, such as Wikimedia Commons, through its API
  • ForeignDBRepo accesses files through a database, and is useful for creating wiki families
  • FSRepo accesses files from a local folder

In all cases, one would be able to embed files into a page using ordinary image syntax and specifying the name of the file in the foreign repository. Note that some of the above implementations are still experimental, and might not be suitable for production sites.

Notes

  1. Wikimedia sites also do not rely on client-side rendering, despite a request to do so, task T5593.