Handbuch:Verwalten von Bildern

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

Artikel beschreibt, wie MediaWiki Bilder verwaltet und speichert sowie einige Hilfestellungen zur Konfiguration.

Das gleiche gilt für jeden anderen Dateityp, der hochgeladen werden kann. Da alle Dateien im Namensraum Bild gespeichert werden, wird hier nur von Bildern gesprochen. Prior to MediaWiki 1.14, the "Image:" namespace was used instead. "Image:" is still retained as an alias for backward compatibility.

Hochladen und Verwenden von Bildern

Siehe Hilfe:Bilder

Hochladen von Bildern ermöglichen

Um Bilder hochzuladen, müssen drei Bedingungen erfüllt sein:

  1. MediaWiki erlaubt das Hochladen. Set $wgEnableUploads to true.
  2. Der Dateityp muss zulässig sein. Mehr Information: $FileExtensions.
  3. Der Anwender muss angemeldet sein. By default this is given to all logged-in users.

Hochgeladen wird über die Seite Specialpage Upload.

See Handbuch:Datei-Uploads konfigurieren , Manual:MIME type detection and Manual:Adding support for new filetypes

Wichtige Parameter für die Bildverwaltung

Diese sind relevant:

Vorschaubilder

MediaWikis Bildsyntax (engl.) erlaubt eine dynamische Größenänderung und Thumbnailing von Bildern (siehe Handbuch:Datei-Uploads konfigurieren für allgemeine Hilfe zum Hochladen von Dateien).

Vorschaubilder erfordert entweder ImageMagick oder GD-Bibliothek - keines davon sind Teil der MediaWiki-Standardinstallation.

GD

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

GD kann von https://libgd.github.io/ heruntergeladen werden. In neueren Versionen ist dies nicht erforderlich.

ImageMagick

In MediaWiki, enable ImageMagick in LocalSettings.php by setting $wgUseImageMagick to true.

ImageMagick kann von https://imagemagick.org/ heruntergeladen werden.

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

Wenn Sie ImageMagick verwenden, setzen Sie $UseImageMagick auf true in LocalSettings.php. Make sure that the command is executable by the web server process. Zum Beispiel, Windows-Anwender wollen die Standardeinstellung ändern zu "C:\ImageMagick\convert.exe" (oder ähnlich).

Um alte Vorschau-Dateien neu zu erstellen, bevor Sie ImageMagick verwendeten, können Sie $wgThumbnailEpoch verwenden.

Wenn Rendering fehlschlägt, überprüfen und erhöhen Sie $wgMaxShellMemory .

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

GraphicsMagick can also be used as an alternative to ImageMagick. You will need to set $wgCustomConvertCommand to the following. z.B.:

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

Image formats

GIF

Für eine Vorschau bei GIF-Animationen unter Windows, müssen Sie ImageMagick wie oben beschrieben installieren.

SVG

Wikimania 2016-Präsentation über dynamische SVGs

MediaWiki unterstützt SVG-Grafik-Rendering: wenn aktiviert, können SVG-Bilder wie andere Bilddateien verwendet werden — sie werden automatisch als PNG-Datei gerendert und wie benötigt als Vorschau angezeigt. Wenn Sie auf einem gemeinsamen Host sind und kein SVG-Renderer vorinstalliert ist, werden Sie wahrscheinlich Ihren Provider fragen, der es für Sie installiert.

Um SVG-Unterstützung zu aktivieren:

  1. Erlauben Sie das hochladen von SVG-Dateien in der Datei LocalSettings.php: $wgFileExtensions [] = 'svg'; Beachten Sie, dass MediaWiki SVG-Dateien mit JavaScript aus Sicherheitsgründen verweigern wird.
    Wenn Sie eine Fehlermeldung erhalten, dass die Datei beschädigt ist, stellen Sie sicher das die MIME-Typ-Erkennung einwandfrei funktioniert.
  2. Fügen Sie $wgSVGConverter zur LocalSettings.php hinzu und stellen Sie den Renderer den Sie verwenden möchten ein.
  1. Verfügbare Optionen sind ImageMagick, ImagickExt, Sodipodi, Inkscape, Batik, libRSVG, und Imgserv (engl.).
  1. Zum Beispiel: $wgSVGConverter = 'ImageMagick';
    • Wenn das Konverter-Programm nicht im Systempfad ist, müssen Sie das Verzeichnis, dass das Programm enthält, durch Verwendung mit $wgSVGConverterPath angeben..
    • libRSVG ist schnell, aber nicht sehr genau. It depends on a large number of libraries. To automatically install all these libraries, you may want to use a package manager. Die Wikimedia-Projekte verwenden rsvg.
    • Batik is the most accurate SVG renderer available, although its anti-aliasing is sometimes suboptimal. 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.

    • Since version 6.x.x ImageMagick renders SVGs, but imperfectly.

This is the default, but avoid it if possible. However, it does work. 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.

      • To prevent thumbnail creation errors with ImageMagick, if it's ≥ 7.0.9-25, then Inkscape must also be ≥ 1.x.x. Likewise, if ImageMagick is < 7.0.9-25, then Inkscape must also be < 1.x.x.

See ImageMagick issue.

    • The PHP Imagick extension supports SVG rendering, however the same considerations as for the regular ImageMagick apply.
    • 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.

Fehlerbehebung

Wenn Sie einen leren Bereich anstatt der SVG sehen (Chrome) oder gar kein Bild (Firefox), alle PNG-Links zu 404-Fehlern führen und Sie keine andere Fehlermeldung irgendwo sehen, überprüfen Sie bitte die $GenerateThumbnailOnParse-Variable. Setting it to false may make SVG transformation deferred always. Make sure that proc_open and symlink PHP methods are enabled (they may be disabled in php.ini for security or performance reasons).


JPEG (mittels GD)

Fügen Sie einfach die folgende Zeile in LocalSettings.php hinzu, um einen automatischen Fallback auf die GD-Bibliothek auszulösen.

$wgUseImageMagick = false;

Für Fehler mit JPEG-Thumbnails, siehe JPEG (mit GD). (engl.)

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


Löschen von Bildern

Grundsätzlich können Bilder nur von Systemadministratoren gelöscht werden, es sei denn die Benutzerrechte wurden verändert. In diesem Absatz wird beschrieben wie Dateien im Ordner /images gelöscht werden. Der zugehörige Artikel Bild:MeinBild wird wie jeder andere Artikel gelöscht und ggf. wieder hergestellt.

Löschen einer alten Bildversion

Wenn ein Bild durch eine neue Version ersetzt wird, dann gibt es eine Bildhistorie. Jede Revision hat einen "Löschen"-Verweis. Wenn dieser angeklickt wird, wird die Revision und die zugehörige Datei unwiderruflich gelöscht.

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.

Undeleting files

Files can be undeleted in exactly the same way as normal wiki pages. The directory in which deleted files are stored is defined by Handbuch:$wgDeletedDirectory . Tabelle filearchive : Information zu den gelöschten Bildern.

Deletion of Archived Files

Since MediaWiki version 1.11, deleted images are still stored on the server by default. If you want to delete selected archived images, you can do so using the eraseArchivedFile.php maintenance script. If you want to delete all of them completely, you can do that with the deleteArchivedFiles.php script. If you delete archived files, you can not undelete those files anymore.

Reasons for Deleting a File

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.

Datenbankablage

Immer wenn ein Bild hochgeladen wird, werden verschiedene Einträge erzeugt:

  1. Ein Artikel im Namensraum Bild mit dem exakten Namen der Datei, z.B. Image:MyPicture.png. Dieser Artikel wird wie jeder andere in MediaWiki gespeichert und verwaltet.
  1. Die Datei selbst wird in einem Ordner im Dateisystem gespeichert, wobei Leerzeichen zusammengefasst werden und ersetzt werden mit _.
  1. Sofern die Datei eine bestimmte Größe überschreitet (800px Höhe oder 600px Breite), wird zusätzlich eine verkleinerte Version erzeugt, die auf 800px Höhe und 600px Breite begrenzt ist.

Jede Bilddatei hat einen eigenen Ordner für diverse verkleinerte Versionen.

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

xy sind die ersten beiden Buchstaben in einem md5-hash des Dateinamens.

ical

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

Beschreibung des "/image" Unterordners:

archive
Hier sind die Originialdateien der durch neuere Version ersetzten Bilder abgelegt.
temp
;temp/0-f/x0-xf: Während des Hochladens verwendet. Oftmals verbleiben alte Dateien hier, diese sollten und können gefahrlos gelöscht werden. (Fehler 9018)
thumb
;thumb/0-f/x0-xf: Automatisch erzeugte kleiner Bildversionen (Thumbnails) für die hochgeladenen Bilder in 0-f. Wenn diese gelöscht werden, werden sie automatich neu erzeugt.

Es kann allerdings anfangs Probleme mit dem Cache geben.

math
Folder to store your rendered TeX input, see also Extension: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 Handbuch:$wgHashedUploadDirectory for more details on why this might be desired and how this system works.

Datenbank Tabellen

  • Der Artikel Bild:MeinBild.png wird wie jeder andere Artikel abgelegt: Tabellen page, text, revision etc.
  • image - * Tabelle Image: Enthält Meta-Daten zum Bild wie z.B. die Größe. Es ist kein Pfad zur Datei gespeichert, dieser wird über den Dateinamen (Hash) berechnet und ist der Grund dafür, dass Bilder nicht verschoben werden können.
  • oldimage - * Tabelle Oldimage: Dies ist die Archivtabelle für Bilder, die durch neuere ersetzt wurden. Hinweis: gelöschte Bilder werden hier nicht abgelegt.
  • filearchive - * Tabelle Filearchive: Information zu den gelöschten Bildern.
  • imagelinks - * Tabelle Imagelinks: Bildverweise: Welcher Artikel nutzt das Bild.

Platzverbrauch

Bilder brauchen naturgemäß mehr Platz als Artikel. Es wird von einer Blockgröße von 4KB bei Linux/Unix Servern ausgegangen,

Die Standardeinstellung ist $wgHashedUploadDirectory = true.

Platzverbrauch nur für die Ordner

  • image Ordner: 0-f/x0-f: max. 16*16 = 256 Ordner = 256*4 KB = 1024 KB
  • archiv Ordner: 0-f/x0-f: max. 16*16 = 256 Ordner = 256*4 KB = 1024 KB
  • thumb Ordner: 0-f/x0-f: max. 16*16 = 256 Ordner = 256*4 KB = 1024 KB
  • temp Ordner: 0-f/x0-f: max. 16*16 = 256 Ordner = 256*4 KB = 1024 KB

Ohne, dass ein Bild gespeichert wurde, werden also 4 MB genutzt (teilweise werden die Ordner allerdings erst im Betrieb angelegt).

Für jedes Bild brauchen wir:

  • Größe der Bilddatei + 2KB durchschnittlicher Mehrbedarf

Für Bilder mit einer Höhe > 600px oder Breite > 800px wird zusätzlicher Platz benötigt:

  • Größe des automatisch erzeugten Thumbnails + 2KB durchschnittlicher Mehrbedarf (Blockgröße)
  • Ordner für den Thumbnail (4KB) (ja, je Bild wird ein eigener Ordner erzeugt)

Beispiele:

  • Bild 20778 Byte png (geringe Größe, kein Thumbnail): 24 KB für das Bild: Total 24 KB
  • Bild 123.000 Byte jpeg (groß, auto Thumbnail): 124 KB für das Bild, 4KB für den Thumbnail Ordner, 64 KB für die verkleinerte Version: Total: 192 KB

File Access

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.