Extensão:ImageMap
ImageMap Estado da versão: estável |
|
---|---|
Implementação | Marcação |
Descrição | Permite mapas de imagem HTML clicáveis |
Autor(es) | Tim Starlingdiscussão |
Última versão | atualizações contínuas |
MediaWiki | 1.23+ |
PHP | 5.4+ |
Composer | mediawiki/image-map |
Licença | GNU GPL (Licença Pública Geral) 2.0 ou superior |
Download | log |
Exemplo | Children's encyclopedia |
Quarterly downloads | 86 (Ranked 64th) |
Public wikis using | 10,714 (Ranked 16th) |
Para traduzir a extensão ImageMap, verifique sua disponibilidade no translatewiki.net | |
Problemas | Tarefas em aberto · Relatar um bug |
A extensão ImageMap permite tornar o mapa da imagem clicável. Um mapa de imagem é uma lista de coordenadas em uma imagem específica, que vincula áreas da imagem a vários destinos (em contraste com um link de imagem normal, no qual toda a área da imagem é vinculada a um único destino). Por exemplo, um mapa do mundo pode ter cada país vinculado a mais informações sobre esse país. A intenção de um mapa de imagem é fornecer uma maneira fácil de vincular várias partes de uma imagem sem dividir a imagem em arquivos de imagem separados.
Exemplos
Exemplo simples sem legenda
<imagemap>
File:Example2.png|150px|alt=Alt text
default [[Main Page|Go to main page]]
</imagemap>
The above example always links to the Main Page, no matter where you click on it. To find out more about the image, click on the blue "i" icon .
An alternative way to create such a linked image, without using this extension would be with [[File:Example2.png|150px|alt=Alt text|title=Go to main page|link=Main Page]]
Exemplo complexo com legenda
This example display a thumbnail with dimensions (width × height) 500 × 250 pixels; the original image has dimensions 9,600 × 4,800 pixels.
The coordinates of each vertex are given in pixels and represent a point on the original image.
So for example, the vertices of the polygon surrounding "Jude" (second to the far right in the image) has horizontal-coordinates (measured in pixels from the left) ranging between 7904
– 8635
and vertical-coordinates (measured in pixels from the top) ranging between 2096
– 3260
, which are far outside of the range of the displayed 500 × 250 thumbnail but within range of the 9,600 × 4,800 original image.
Note that one vertex of the polygon surrounding "Simon" (at the very right of the image), specifically the vertex with coordinate 9625 3301
, lies outside of the bounds of the original 9,600 × 4,800 image.
<imagemap>
File:The Last Supper - Leonardo Da Vinci - High Resolution 32x16.jpg|thumb|center|500px|alt=''The Last Supper'' by Leonardo da Vinci - Clickable Image|Image map example. Clicking on a person in the picture causes the browser to load the appropriate article.
poly 550 2550 750 2400 1150 2300 1150 2150 1200 2075 1500 2125 1525 2300 1350 2800 1450 3000 1700 3300 1300 3475 650 3500 550 3300 450 3000 [[w:Bartholomew the Apostle|Bartholomew]]
poly 1575 2300 1625 2150 1900 2150 1925 2500 1875 2600 1800 2750 1600 3250 1425 3100 1400 2800 1375 2600 [[w:James, son of Alphaeus|James Minor]]
poly 1960 2150 2200 2150 2350 2500 2450 2575 2375 2725 2375 2900 2225 3100 2225 3225 1600 3225 1825 2700 1975 2450 1925 2300 [[w:Saint Andrew|Andrew]]
poly 2450 2575 2775 2500 2700 2650 2800 2700 2600 3000 2600 3250 2300 3250 2200 3200 2300 3000 [[w:Saint Peter|Peter]]
poly 2750 2500 2950 2400 3125 2600 3175 2700 3300 2850 3700 3200 3750 3200 3650 3350 3400 3200 3000 3350 2600 3325 2750 2800 2900 2700 2700 2650 [[w:Judas Iscariot|Judas]]
poly 3000 2350 3300 2350 3350 2660 3560 2600 3565 2690 3250 2800 3125 2575 [[w:Saint Peter|Peter]]
poly 3332 2338 3528 2240 4284 3024 4074 3332 3864 3290 3780 3150 3668 3192 3598 3024 3374 2870 3388 2772 3542 2800 3668 2702 3542 2590 3430 2604 3350 2600 3300 2500[[w:John the Apostle|John]]
poly 4775 2184 4915 2128 5055 2212 5083 2352 5111 2464 5181 2604 5307 2744 5573 3052 5615 3192 5657 3290 5573 3402 5461 3332 5335 3248 4495 3248 4439 3388 4243 3388 4075 3360 4173 3136 4327 3010 4509 2730 4663 2520 4733 2394 [[w:Jesus]]
poly 5900 2100 5900 2150 5800 2400 5800 2500 5675 2589 5480 2671 5438 2507 5425 2301 5589 2452 5630 2301 5650 2100 [[w:Thomas the Apostle|Thomas]]
poly 5918 2150 6041 2109 6137 2246 6192 2411 6110 2589 6110 2726 6192 2822 6302 2740 6589 3109 5658 3178 5575 2918 5300 2698 5233 2589 5274 2438 5370 2507 5521 2685 5617 2671 5712 2575 5822 2507 5808 2287 5822 2175 [[w:James, son of Zebedee|James Greater]]
poly 6137 2013 6439 2013 6863 2260 7110 2515 6726 2675 6507 2548 6425 2630 6356 2753 6548 2849 6699 2781 7082 2794 7178 3109 6699 3178 6548 2986 6397 2835 6165 2775 6110 2589 6233 2438 6302 2383 6151 2287 6096 2164 [[w:Philip the Apostle|Philip]]
poly 7635 2123 7800 2013 8000 2055 8025 2287 7950 2438 8000 2698 8055 2918 7959 3164 7233 3164 7124 2972 7124 2794 6548 2794 6384 2781 6384 2671 6493 2575 6750 2650 7075 2550 7219 2400 7625 2300 [[w:Matthew the Apostle|Matthew]]
poly 8325 2096 8600 2109 8635 2493 8615 2726 8439 2781 8274 2740 8125 2835 8151 2931 8400 2975 8411 3068 8589 3041 8617 3205 7987 3260 8124 3027 7987 2644 7904 2493 7959 2425 8096 2356 [[w:Judas Thaddaeus|Jude]]
poly 8800 2150 8900 2125 9055 2150 9125 2397 9400 2475 9550 2931 9625 3301 9151 3397 8535 3219 8726 3014 8466 3068 8411 2918 8178 2931 8124 2835 8329 2753 8535 2794 8726 2603 8725 2342 [[w:Simon the Zealot|Simon]]
</imagemap>
The above example links to many different pages, depending on where you click it. To find out more about the image, click on the double-rectangle icon
Syntax description
The contents of an <imagemap>
tag consists of blank lines, comments (starting with #) and logical lines.
The first logical line specifies the image to be displayed.
This must be in the same format as an ordinary MediaWiki image link (see images help), except without the enclosing [[
and ]]
markup.
If the first line specifies a "thumb
" or "frame
" image, then the first line's caption and any |alt=
parameter are treated as the image's caption and alt text in the usual way; otherwise, the first line's |alt=
parameter (or, if absent, any caption) specifies the image's alt text.
In neither case does the image itself have title text (often used for tooltips); any title text is taken from the regions described in later lines.
Further lines are split into tokens, separated by whitespace. The function of each line is determined by the first token in the line.
A coordinate consists of two tokens. The first token is the horizontal (X) position and the second token is the vertical (Y) position. All coordinates are according to the full-size image, not the visible image. The X and Y tokens should be specified as distance from left edge (horizontal pixel count) and distance from top (vertical pixel count) of the full-size image.
- desc
- Specifies the location of a blue "i" icon , which links to the image description. Possible values:
top-right
,bottom-right
(default),bottom-left
,top-left
,none
. This parameter is ignored for "thumb
" or "frame
" images, which instead employ the usual double-rectangle icon .
- poly
- A polygon. The coordinates of the vertices are given, followed by a link in square brackets.
- rect
- A rectangle. The parameters are the coordinates of the top-left and bottom-right corners, followed by a title to link to in square brackets.
- Example
<imagemap> File:PolierMartinWombwellZoffany.jpg|thumb|200px|Colonel Antoine Polier rect 269 140 344 305 [[Claude Martin]] rect 124 147 181 298 [[Antoine Polier|Antoine-Louis Polier]] desc none </imagemap>
- circle
- A circle. The first two parameters are the coordinates of the center, the third is the radius. The coordinates are followed by a link in square brackets.
- default
- This gives the default link, where no other regions are specified.
All coordinates are specified relative to the source image. The image can be scaled using thumbnail syntax, in which case the image map coordinates will be automatically scaled as well.
All links are given in either the form [[Page title]] or [[Page title|description]]. In the latter case, the part after the pipe "|" becomes the title attribute of the link—in most browsers, it will pop up as a tooltip when the user hovers over it; the part after the pipe also becomes the alt text for the link. If no explicit link description is given, the page title is used.
Areas which overlap give precedence to the first link listed.
Instalação
Make sure that uploads and ImageMagick are installed:
$wgEnableUploads = true;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "/usr/bin/convert";
- Baixe e coloque o(s) arquivo(s) num diretório chamado
ImageMap
na sua pastaextensions/
.
Developers and code contributors should install the extension from Git instead, using:cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/ImageMap - Adicione o seguinte código ao final do seu arquivo LocalSettings.php :
wfLoadExtension( 'ImageMap' );
- Concluído – Navegue à página Special:Version em sua wiki para verificar se a instalação da extensão foi bem sucedida.
- Troubleshooting
- Check to see if your php DOM is turned on. You may need to install it if it is not.
- Check whether ImageMagick is installed, since this extension relies on /usr/bin/convert for the resizing. If it is not present, you could get a page with only XML errors (tip: use the back-button in the browser, because you can still edit the page).
- On OVH mutualized hosting
$wgUseImageMagick
should be like:$wgUseImageMagick=false;
Composer
You can also install this extension using built-in Composer support.
composer require mediawiki/image-map @dev
composer update --no-dev
" command.
Uso com templates, palavras mágicas ou funções de analisador
If you want this extension (as with most tag extensions) to parse template parameters, magic words, or parser functions, you will need to use #tag
syntax, such as w:Template:Click did.
In this case the vertical bar |
must be replaced by a template {{!}}
, where the source text of the template is |
(except when they appear inside links or parameters).
- Example - standard form:
<imagemap>
File:ExamplePlant80.png|60px|ExamplePlant
rect 0 107 294 260 [[Plants/ExamplePlant|ExamplePlant]]
desc none
</imagemap>
- Example - with variable
{{PAGENAME}}
{{#tag:imagemap| File:ExamplePlant80.png{{!}}60px{{!}}ExamplePlant rect 0 107 294 260 [[{{PAGENAME}}/ExamplePlant|ExamplePlant]] desc none }}
- Example – Modified to accept an input parameter to control image size:
These modifications allow the template size to be adjusted on the edited (target) page and eliminate the need to create duplicate templates of various image sizes.
{{#tag:imagemap| Image:Examplename.jpg {{!}}{{{1|640px}}} rect 0 107 294 260 circle 360 114 70 poly 357 216 363 417 211 desc none }}
Where {{{1|640px}}}
is the input parameter “1” and a default image size of 640px.
Note: the input parameter requires a text string ending with “px” to function properly.
For example, calling a template {{TemplateName|400px}}
will display the template at 400 pixels.
To convert the standard (existing) image maps to this optional format:
- Replace the initial
<imagemap>
with{{#tag:imagemap|
- Add
{{!}}{{{1|640px}}}
after the image name (change the default image size to match the currently existing size).
- Note: By changing the default size (640px in this example) to the current image size, none of the existing template calls will have to be modified and will display correctly. Existing template calls can still be modified later by using the input parameter.
- Replace the final
</imagemap>
with}}
(the trailing braces).
Ver também
- Instructions
- A simple guide on how to use the Image Map editor with the ImageMap extension can be found at ImageMapEdit Howto on Meta-Wiki.
- A detailed guide for using the maschek image map editor can be found at this site.
- Wikimedia Commons also has a resource page on image maps: Commons:Image map resources
- Existing image maps examples: Category:Wikipedia image maps
- Wiki tools
- meta:User:Dapete/ImageMapEdit#English - ImageMapEdit script, a graphical tool to determine the coordinates that can be installed on any wiki.
- Online tools
- http://www.maschek.hu/imagemap/imgmap Online image map editor, supports all shapes, Extension:ImageMap compatible.
- http://www.image-maps.com/index.php? Basic on-line image mapper.
- http://summerstyle.github.io/summer/ - Open-source interactive online image mapper
- Similar functionalities
- Extension:DrawioEditor - working with diagrams and drawings
Esta extensão está sendo usada(o) por um ou mais projetos da Wikimedia. Isto significa que, provavelmente, a extensão é estável e funciona bem o suficiente para ser utilizada(o) em sites da web de alto tráfego. Procure pelo nome dessa extensão nos arquivos de configuração CommonSettings.php e InitialiseSettings.php da Wikimedia para verificar onde ela foi instalada. Uma lista completa das extensões instaladas numa wiki em particular podem ser visualizadas na página Special:Version da wiki. |
Esta extensão está incluída nas seguintes fazendas/hospedagens (farms/hosts) e/ou pacotes wiki: Esta não é uma lista autoritativa (oficial). Algumas fazendas/hospedagens (farms/hosts) e/ou pacotes wiki podem conter esta extensão mesmo que não estejam listados aqui. Sempre verifique com suas fazendas/hospedagens (farms/hosts) ou pacotes wiki para confirmar. |
- Extensions bundled with MediaWiki 1.21/pt-br
- Stable extensions/pt-br
- Tag extensions/pt-br
- Extensions supporting Composer/pt-br
- GPL licensed extensions/pt-br
- Extensions in Wikimedia version control/pt-br
- ParserFirstCallInit extensions/pt-br
- All extensions/pt-br
- Extensions used on Wikimedia/pt-br
- Extensions included in BlueSpice/pt-br
- Extensions included in Canasta/pt-br
- Extensions available as Debian packages/pt-br
- Extensions included in Fandom/pt-br
- Extensions included in Miraheze/pt-br
- Extensions included in MyWikis/pt-br
- Extensions included in ProWiki/pt-br
- Extensions included in semantic::core/pt-br
- Extensions included in ShoutWiki/pt-br
- Extensions included in Telepedia/pt-br
- Extensions included in wiki.gg/pt-br
- Extensions included in WikiForge/pt-br
- Link extensions/pt-br
- Image map extensions/pt-br