Extension:MarkImages/pl

This page is a translated version of the page Extension:MarkImages and the translation is 12% complete.
Podręcznik rozszerzeń MediaWiki
MarkImages
Status wydania: stabilne
Realizacja Hak
Opis Marks images on special and category pages based on their categories
Autor(zy) Ostrzycieldyskusja
Ostatnia wersja 1.1.0
Polityka zgodności Snapshots releases along with MediaWiki. Master nie jest kompatybilny wstecznie.
MediaWiki 1.29+
PHP 5.6+
Zmiany w bazie danych Nie
Licencja Licencja MIT
Pobieranie

GitLab:

Uwaga:
Żadne aktualizacje języków nie są
dostarczane przez translatewiki.net .

Przykład Image category on Nonsensopedia with images marked according to their license
  • $wgMarkImagesCategories

The MarkImages extension marks images in galleries on special and category pages based on image's categories.

The user can specify rules for which categories should correspond to what CSS classes. The extension then adds these CSS classes to divs of corresponding images in galleries. It is intended for marking images based on their licenses, but can be used for other purposes, too.

Instalacja

  • Download i umieść plik(i) w katalogu o nazwie MarkImages w swoim katalogu extensions/.
  • Dodaj poniższy kod na dole twojego pliku LocalSettings.php :
    wfLoadExtension( 'MarkImages' );
    
  •   Zrobione – Przejdź do Special:Version na twojej wiki, aby sprawdzić czy rozszerzenie zostało pomyślnie zainstalowane.

Configuration

All configuration is done through a single configuration variable: $wgMarkImagesCategories. You should put it somewhere in your LocalSettings.php file. It should contain a list of category-CSS class pairs in the following format:

$wgMarkImagesCategories = [
	"recursive" => [
		"Category:Example_1" => "example-1",
		"Category:Example_2" => "example-2"
	],
	"nonrecursive" => [
		"Category:Example_3" => "example-3"
	]
];

The category name should always include the "Category:" prefix in your wiki's local language (canonical). Categories placed in the recursive section will have their rules applied to all child categories. Categories in the nonrecursive section will have their rules applied only to them, without subcategories. You can specify as many rules as you like, you can also use the same CSS class multiple times and apply multiple classes to a single image.

You have to define these CSS classes yourself. You can place them for example in MediaWiki:Common.css to make it apply to all desktop skins, or in a gadget to allow your users to enable or disable this feature. The extension appends these classes to the div element with thumb CSS class. A simple example from Nonsensopedia of a CSS class you can use for modifying image's background:

.file-free {
	background-color: #B0FAB0 !important;
}

After setting up the extension you should run the initImageClasses.php script provided in the maintenance folder to initialize CSS class cache and see the results. The extension will automatically update the cache whenever an image's description page is changed or null-edited. It will not update the cache when you modify the configuration or change the category tree in some way. In such a case you will have to have to rerun this maintenance script or null-edit all affected pages.

How it works

After a user saves a description page, the extension grabs the image's categories and checks them against all rules specified in $wgMarkImagesCategories. It builds an array of CSS classes that should be applied to this image and saves these classes in the page_props table. When a gallery is rendered on a category or special page, the extension inserts these extra CSS classes cached in the database. The extension relies entirely on the cache, so it should be reasonably fast.