Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
MainPage
Community portal
Recent changes
Random page
Help
Special pages
Donate
Search
Search
English
Appearance
Log in
Request account
Personal tools
Log in
Request account
Export translations
Translate
English
Language statistics
Message group statistics
Export
Tools
Tools
move to sidebar
hide
Actions
Language statistics
Message group statistics
Export
General
Printable version
In other projects
Appearance
move to sidebar
hide
Settings
Group
Category:Maintenance
Help:Blocking users
Help:Bots
Help:Categories
Help:Contents
Help:Deletion and undeletion
Help:Diff
Help:Editing pages
Help:ExpandTemplates
Help:Extension:ParserFunctions
Help:External searches
Help:Formatting
Help:Images
Help:Links
Help:Magic words
Help:Managing files
Help:Moving a page
Help:Namespaces
Help:Navigation
Help:Parser functions in templates
Help:Patrolled edits
Help:Preferences
Help:Protected pages
Help:Random page
Help:Random root page
Help:Range blocks
Help:Recent changes
Help:Redirects
Help:Skins
Help:Special pages
Help:Starting a new page
Help:Substitution
Help:System message
Help:Tables
Help:Talk pages
Help:TemplateData
Help:Templates
Help:TemplateStyles
Help:Tracking changes
Help:Undelete
Help:User contributions
Help:Watchlist
Help:What links here
Manual:Expr parser function syntax
Manual:Extending wiki markup
Manual:Hooks
Manual:Magic words
Manual:Messages API
Manual:Parser functions
Module:Arguments/doc
Module:Int/doc
Module:Message box/configuration/doc
Module:Message box/doc
Module:Template translation/doc
Module:Transcluder/doc
Module:Version/doc
Module:Yesno/doc
News
Parser extension tags
Parser function extensions
Project:Language policy
Template:Admin tip
Template:Advanced user manual
Template:Anontools
Template:ApiEx
Template:Autocat
Template:Auxiliary template common notice
Template:Branching
Template:Bugfix
Template:Bugzilla
Template:Button
Template:Candidate
Template:Caution
Template:Clarify
Template:Collapse top
Template:Component
Template:Deprecated-inline
Template:Description missing
Template:Distinguish
Template:Documentation
Template:Documentation subpage
Template:Done
Template:EmptyCatGood
Template:Escape template list
Template:Excerpt
Template:Extension development
Template:Fixtext
Template:For
Template:Further
Template:Help
Template:High-risk
Template:Historical
Template:I18n navigation
Template:In progress
Template:Intricate template
Template:Introduced-inline
Template:IRC
Template:Localized link
Template:Localized link/messagedoc
Template:Magic words
Template:Main
Template:MainPage
Template:Markup
Template:Markup/row
Template:Mbox templates
Template:Module rating
Template:Move
Template:MW version
Template:MW version/layout
Template:N/a
Template:Navbar
Template:Newarticletext
Template:No
Template:Not done
Template:Note
Template:Optional
Template:Parser functions nav
Template:Partially done
Template:PD Help Page
Template:Phabricator
Template:Ptag
Template:Purge
Template:Recentchangestext
Template:Removed-inline
Template:Required
Template:Rev
Template:Security
Template:See
Template:See also
Template:Sp-contributions-footer
Template:Sp-contributions-footer-anon
Template:Special page
Template:Template shortcut
Template:Template test cases notice
Template:TemplateData header
Template:Thankyou
Template:To do
Template:Tracked
Template:Translatable
Template:Translatable template name
Template:Unusedtemplatestext
Template:Update
Template:Used in system
Template:Watchlists navigation
Template:Why
Template:WikiNonStop News
Template:Yes
TemplateData
Language
aa - Afar
aae - Arbëresh
ab - Abkhazian
abr - Abron
abs - Ambonese Malay
ace - Acehnese
acf - Saint Lucian Creole
acm - Iraqi Arabic
ady - Adyghe
ady-cyrl - Adyghe (Cyrillic script)
aeb - Tunisian Arabic
aeb-arab - Tunisian Arabic (Arabic script)
aeb-latn - Tunisian Arabic (Latin script)
af - Afrikaans
aig - Antiguan and Barbudan Creole English
aln - Gheg Albanian
alt - Southern Altai
am - Amharic
ami - Amis
an - Aragonese
ang - Old English
ann - Obolo
anp - Angika
apc - Levantine Arabic
ar - Arabic
arc - Aramaic
arn - Mapuche
arq - Algerian Arabic
ary - Moroccan Arabic
arz - Egyptian Arabic
as - Assamese
ase - American Sign Language
ast - Asturian
atj - Atikamekw
av - Avaric
avk - Kotava
awa - Awadhi
ay - Aymara
az - Azerbaijani
azb - South Azerbaijani
ba - Bashkir
ban - Balinese
ban-bali - Balinese (Balinese script)
bar - Bavarian
bbc - Batak Toba
bbc-latn - Batak Toba (Latin script)
bcc - Southern Balochi
bci - Baoulé
bcl - Central Bikol
bdr - West Coast Bajau
be - Belarusian
be-tarask - Belarusian (Taraškievica orthography)
bew - Betawi
bg - Bulgarian
bgc - Haryanvi
bgn - Western Balochi
bh - Bhojpuri
bho - Bhojpuri
bi - Bislama
bjn - Banjar
blk - Pa'O
bm - Bambara
bn - Bangla
bo - Tibetan
bpy - Bishnupriya
bqi - Bakhtiari
br - Breton
brh - Brahui
bs - Bosnian
btm - Batak Mandailing
bto - Rinconada Bikol
bug - Buginese
bug-bugi - Buginese (Buginese script)
bxr - Russia Buriat
ca - Catalan
cbk-zam - Chavacano
ccp - Chakma
cdo - Mindong
cdo-hant - Mindong (Traditional Han script)
cdo-latn - Mindong (Latin script)
ce - Chechen
ceb - Cebuano
ch - Chamorro
chn - Chinook Jargon
cho - Choctaw
chr - Cherokee
chy - Cheyenne
ckb - Central Kurdish
co - Corsican
cop - Coptic
cps - Capiznon
cpx - Puxian
cpx-hans - Puxian (Simplified Han script)
cpx-hant - Puxian (Traditional Han script)
cpx-latn - Puxian (Latin script)
cr - Cree
crh - Crimean Tatar
crh-cyrl - Crimean Tatar (Cyrillic script)
crh-latn - Crimean Tatar (Latin script)
crh-ro - Dobrujan Tatar
cs - Czech
csb - Kashubian
cu - Church Slavic
cv - Chuvash
cy - Welsh
da - Danish
dag - Dagbani
de - German
de-at - Austrian German
de-ch - Swiss High German
de-formal - German (formal address)
dga - Southern Dagaare
din - Dinka
diq - Dimli
dlg - Dolgan
dsb - Lower Sorbian
dtp - Central Dusun
dty - Doteli
dua - Duala
dv - Divehi
dz - Dzongkha
ee - Ewe
efi - Efik
egl - Emilian
el - Greek
eml - Emiliano-Romagnolo
en - English
en-ca - Canadian English
en-gb - British English
eo - Esperanto
es - Spanish
es-419 - Latin American Spanish
es-formal - Spanish (formal address)
et - Estonian
eu - Basque
ext - Extremaduran
fa - Persian
fat - Fanti
ff - Fula
fi - Finnish
fit - Tornedalen Finnish
fj - Fijian
fo - Faroese
fon - Fon
fr - French
frc - Cajun French
frp - Arpitan
frr - Northern Frisian
fur - Friulian
fvr - Fur
fy - Western Frisian
ga - Irish
gaa - Ga
gag - Gagauz
gan - Gan
gan-hans - Gan (Simplified Han script)
gan-hant - Gan (Traditional Han script)
gcf - Guadeloupean Creole
gcr - Guianan Creole
gd - Scottish Gaelic
gl - Galician
gld - Nanai
glk - Gilaki
gn - Guarani
gom - Goan Konkani
gom-deva - Goan Konkani (Devanagari script)
gom-latn - Goan Konkani (Latin script)
gor - Gorontalo
got - Gothic
gpe - Ghanaian Pidgin
grc - Ancient Greek
gsw - Alemannic
gu - Gujarati
guc - Wayuu
gur - Frafra
guw - Gun
gv - Manx
ha - Hausa
hak - Hakka Chinese
hak-hans - Hakka (Simplified Han script)
hak-hant - Hakka (Traditional Han script)
hak-latn - Hakka (Latin script)
haw - Hawaiian
he - Hebrew
hi - Hindi
hif - Fiji Hindi
hif-latn - Fiji Hindi (Latin script)
hil - Hiligaynon
hke - Hunde
hno - Northern Hindko
ho - Hiri Motu
hoc-latn - Ho (Latin script)
hr - Croatian
hrx - Hunsrik
hsb - Upper Sorbian
hsn - Xiang
ht - Haitian Creole
hu - Hungarian
hu-formal - Hungarian (formal address)
hy - Armenian
hyw - Western Armenian
hz - Herero
ia - Interlingua
iba - Iban
ibb - Ibibio
id - Indonesian
ie - Interlingue
ig - Igbo
igl - Igala
ii - Sichuan Yi
ik - Inupiaq
ike-cans - Eastern Canadian (Aboriginal syllabics)
ike-latn - Eastern Canadian (Latin script)
ilo - Iloko
inh - Ingush
io - Ido
is - Icelandic
isv-cyrl - Interslavic (Cyrillic script)
isv-latn - Interslavic (Latin script)
it - Italian
iu - Inuktitut
ja - Japanese
jam - Jamaican Creole English
jbo - Lojban
jut - Jutish
jv - Javanese
ka - Georgian
kaa - Kara-Kalpak
kab - Kabyle
kai - Karekare
kaj - Jju
kbd - Kabardian
kbd-cyrl - Kabardian (Cyrillic script)
kbp - Kabiye
kcg - Tyap
kea - Kabuverdianu
kg - Kongo
kge - Komering
khw - Khowar
ki - Kikuyu
kiu - Kirmanjki
kj - Kuanyama
kjh - Khakas
kjp - Eastern Pwo
kk - Kazakh
kk-arab - Kazakh (Arabic script)
kk-cn - Kazakh (China)
kk-cyrl - Kazakh (Cyrillic script)
kk-kz - Kazakh (Kazakhstan)
kk-latn - Kazakh (Latin script)
kk-tr - Kazakh (Turkey)
kl - Kalaallisut
km - Khmer
kn - Kannada
knc - Central Kanuri
ko - Korean
ko-kp - Korean (North Korea)
koi - Komi-Permyak
kr - Kanuri
krc - Karachay-Balkar
kri - Krio
krj - Kinaray-a
krl - Karelian
ks - Kashmiri
ks-arab - Kashmiri (Arabic script)
ks-deva - Kashmiri (Devanagari script)
ksh - Colognian
ksw - S'gaw Karen
ku - Kurdish
ku-arab - Kurdish (Arabic script)
ku-latn - Kurdish (Latin script)
kum - Kumyk
kus - Kusaal
kv - Komi
kw - Cornish
ky - Kyrgyz
la - Latin
lad - Ladino
lb - Luxembourgish
lbe - Lak
lez - Lezghian
lfn - Lingua Franca Nova
lg - Ganda
li - Limburgish
lij - Ligurian
liv - Livonian
ljp - Lampung Api
lki - Laki
lld - Ladin
lmo - Lombard
ln - Lingala
lo - Lao
loz - Lozi
lrc - Northern Luri
lt - Lithuanian
ltg - Latgalian
lua - Luba-Lulua
lus - Mizo
luz - Southern Luri
lv - Latvian
lzh - Literary Chinese
lzz - Laz
mad - Madurese
mag - Magahi
mai - Maithili
map-bms - Banyumasan
mdf - Moksha
mg - Malagasy
mh - Marshallese
mhr - Eastern Mari
mi - Māori
min - Minangkabau
mk - Macedonian
ml - Malayalam
mn - Mongolian
mnc - Manchu
mnc-latn - Manchu (Latin script)
mnc-mong - Manchu (Mongolian script)
mni - Manipuri
mnw - Mon
mo - Moldovan
mos - Mossi
mr - Marathi
mrh - Mara
mrj - Western Mari
ms - Malay
ms-arab - Malay (Jawi script)
mt - Maltese
mui - Musi
mus - Muscogee
mwl - Mirandese
my - Burmese
myv - Erzya
mzn - Mazanderani
na - Nauru
nah - Nahuatl
nan - Minnan
nan-hant - Minnan (Traditional Han script)
nan-latn-pehoeji - Minnan (Pe̍h-ōe-jī)
nan-latn-tailo - Minnan (Tâi-lô)
nap - Neapolitan
nb - Norwegian Bokmål
nds - Low German
nds-nl - Low Saxon
ne - Nepali
new - Newari
ng - Ndonga
nia - Nias
nit - Southeastern Kolami
niu - Niuean
nl - Dutch
nl-informal - Dutch (informal address)
nmz - Nawdm
nn - Norwegian Nynorsk
no - Norwegian
nod - Northern Thai
nog - Nogai
nov - Novial
nqo - N’Ko
nr - South Ndebele
nrm - Norman
nso - Northern Sotho
nup - Nupe
nv - Navajo
ny - Nyanja
nyn - Nyankole
nyo - Nyoro
nys - Nyungar
oc - Occitan
ojb - Northwestern Ojibwa
olo - Livvi-Karelian
om - Oromo
or - Odia
os - Ossetic
pa - Punjabi
pag - Pangasinan
pam - Pampanga
pap - Papiamento
pap-aw - Papiamento (Aruba)
pcd - Picard
pcm - Nigerian Pidgin
pdc - Pennsylvania German
pdt - Plautdietsch
pfl - Palatine German
pi - Pali
pih - Pitcairn-Norfolk
pl - Polish
pms - Piedmontese
pnb - Western Punjabi
pnt - Pontic
prg - Prussian
ps - Pashto
pt - Portuguese
pt-br - Brazilian Portuguese
pwn - Paiwan
qqq - Message documentation
qu - Quechua
qug - Chimborazo Highland Quichua
rgn - Romagnol
rif - Riffian
rki - Arakanese
rm - Romansh
rmc - Carpathian Romani
rmy - Vlax Romani
rn - Rundi
ro - Romanian
roa-tara - Tarantino
rsk - Pannonian Rusyn
ru - Russian
rue - Rusyn
rup - Aromanian
ruq - Megleno-Romanian
ruq-cyrl - Megleno-Romanian (Cyrillic script)
ruq-latn - Megleno-Romanian (Latin script)
rut - Rutul
rw - Kinyarwanda
ryu - Okinawan
sa - Sanskrit
sah - Yakut
sas - Sasak
sat - Santali
sc - Sardinian
scn - Sicilian
sco - Scots
sd - Sindhi
sdc - Sassarese Sardinian
sdh - Southern Kurdish
se - Northern Sami
se-fi - Northern Sami (Finland)
se-no - Northern Sami (Norway)
se-se - Northern Sami (Sweden)
sei - Seri
ses - Koyraboro Senni
sg - Sango
sgs - Samogitian
sh - Serbo-Croatian
sh-cyrl - Serbo-Croatian (Cyrillic script)
sh-latn - Serbo-Croatian (Latin script)
shi - Tachelhit
shi-latn - Tachelhit (Latin script)
shi-tfng - Tachelhit (Tifinagh script)
shn - Shan
shy - Shawiya
shy-latn - Shawiya (Latin script)
si - Sinhala
simple - Simple English
sjd - Kildin Sami
sje - Pite Sami
sk - Slovak
skr - Saraiki
skr-arab - Saraiki (Arabic script)
sl - Slovenian
sli - Lower Silesian
sm - Samoan
sma - Southern Sami
smn - Inari Sami
sms - Skolt Sami
sn - Shona
so - Somali
sq - Albanian
sr - Serbian
sr-ec - Serbian (Cyrillic script)
sr-el - Serbian (Latin script)
srn - Sranan Tongo
sro - Campidanese Sardinian
ss - Swati
st - Southern Sotho
stq - Saterland Frisian
sty - Siberian Tatar
su - Sundanese
sv - Swedish
sw - Swahili
syl - Sylheti
szl - Silesian
szy - Sakizaya
ta - Tamil
tay - Atayal
tcy - Tulu
tdd - Tai Nuea
te - Telugu
tet - Tetum
tg - Tajik
tg-cyrl - Tajik (Cyrillic script)
tg-latn - Tajik (Latin script)
th - Thai
ti - Tigrinya
tig - Tigre
tk - Turkmen
tl - Tagalog
tly - Talysh
tly-cyrl - Talysh (Cyrillic script)
tn - Tswana
to - Tongan
tok - Toki Pona
tpi - Tok Pisin
tr - Turkish
tru - Turoyo
trv - Taroko
ts - Tsonga
tt - Tatar
tt-cyrl - Tatar (Cyrillic script)
tt-latn - Tatar (Latin script)
ttj - Tooro
tum - Tumbuka
tw - Twi
ty - Tahitian
tyv - Tuvinian
tzm - Central Atlas Tamazight
udm - Udmurt
ug - Uyghur
ug-arab - Uyghur (Arabic script)
ug-latn - Uyghur (Latin script)
uk - Ukrainian
ur - Urdu
uz - Uzbek
uz-cyrl - Uzbek (Cyrillic script)
uz-latn - Uzbek (Latin script)
ve - Venda
vec - Venetian
vep - Veps
vi - Vietnamese
vls - West Flemish
vmf - Main-Franconian
vmw - Makhuwa
vo - Volapük
vot - Votic
vro - Võro
wa - Walloon
wal - Wolaytta
war - Waray
wls - Wallisian
wlx - Wali
wo - Wolof
wuu - Wu
wuu-hans - Wu (Simplified Han script)
wuu-hant - Wu (Traditional Han script)
xal - Kalmyk
xh - Xhosa
xmf - Mingrelian
xsy - Saisiyat
yi - Yiddish
yo - Yoruba
yrl - Nheengatu
yua - Yucatec Maya
yue - Cantonese
yue-hans - Cantonese (Simplified Han script)
yue-hant - Cantonese (Traditional Han script)
za - Zhuang
zea - Zeelandic
zgh - Standard Moroccan Tamazight
zgh-latn - Standard Moroccan Tamazight (Latin script)
zh - Chinese
zh-cn - Chinese (China)
zh-hans - Simplified Chinese
zh-hant - Traditional Chinese
zh-hk - Chinese (Hong Kong)
zh-mo - Chinese (Macau)
zh-my - Chinese (Malaysia)
zh-sg - Chinese (Singapore)
zh-tw - Chinese (Taiwan)
zu - Zulu
Format
Export for off-line translation
Export in native format
Export in CSV format
Fetch
<languages/> {{PD Help Page}} <span lang="en" dir="ltr" class="mw-content-ltr">This page explains the '''image''' syntax when editing the wiki.</span> <span lang="en" dir="ltr" class="mw-content-ltr">You or another user must usually [[Special:MyLanguage/Help:Managing files|upload an image]] before you can use it on a page.</span> <span lang="en" dir="ltr" class="mw-content-ltr">Images that are stored on a MediaWiki server are usually rendered by using the <code>File:</code> namespace prefix (but the legacy <code>Image:</code> namespace prefix is still supported as a synonym) as the target of a MediaWiki link.</span> <span lang="en" dir="ltr" class="mw-content-ltr">The alternate <code>Media:</code> namespace prefix is also usable to reference the original media file content (for rendering or downloading it separately, out of any MediaWiki page).</span> <div lang="en" dir="ltr" class="mw-content-ltr"> == Requisites == </div> <span lang="en" dir="ltr" class="mw-content-ltr">Before using images in your page, the system administrator of your wiki must have [[Special:MyLanguage/Manual:Configuring file uploads|enabled file uploads]] and a user has to [[Special:MyLanguage/Help:Managing files|upload the file]].</span> <span lang="en" dir="ltr" class="mw-content-ltr">System administrators may also set the wiki to accept files from [[Special:MyLanguage/Manual:Image Administration#Foreign Repositories|foreign repositories]], such as the [http://commons.wikimedia.org/wiki/Main_Page Wikimedia Commons].</span> <span lang="en" dir="ltr" class="mw-content-ltr">For server side image resizing it is necessary to have a scaler configured (such as GD2, ImageMagick, etc.).</span> <div lang="en" dir="ltr" class="mw-content-ltr"> == Supported media types for images == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The following file formats are supported by default: </div> * <code>.jpg</code> <span lang="en" dir="ltr" class="mw-content-ltr">or</span> <code>.jpeg</code> – <span lang="en" dir="ltr" class="mw-content-ltr">bitmap image compressed in the standard JPEG format (this lossy format is most suitable for photographs).</span> * <code>.png</code> – <span lang="en" dir="ltr" class="mw-content-ltr">bitmap image in the ''[[w:Portable Network Graphics|Portable Network Graphics]]'' format (specified by the ''W3 Consortium'').</span> * <code>.gif</code> – <span lang="en" dir="ltr" class="mw-content-ltr">bitmap image in the legacy ''Graphics Interchange Format''.</span> * <code>.webp</code> – <span lang="en" dir="ltr" class="mw-content-ltr">[[w:WebP|WebP]] supports both lossy and lossless compression while reducing image size by up to 45%.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Other formats used on Wikimedia, and commonly enabled elsewhere (these may require extra set-up beyond what is enabled by default): </div> * <code>.svg</code> – <span lang="en" dir="ltr" class="mw-content-ltr">scalable image in the ''Scalable Vector Graphics'' format (specified by the ''W3 Consortium'').</span> <span lang="en" dir="ltr" class="mw-content-ltr">See [[Special:MyLanguage/Manual:Image Administration#SVG|Manual:Image Administration#SVG]].</span> * <code>.tiff</code> – <span lang="en" dir="ltr" class="mw-content-ltr">Tagged image format.</span> <span lang="en" dir="ltr" class="mw-content-ltr">Often used for high-resolution archival photographs.</span> <span lang="en" dir="ltr" class="mw-content-ltr">Often used with {{ll|Extension:PagedTiffHandler}}.</span> * <code>.ogg</code>, <code>.oga</code>, <code>.ogv</code> – <span lang="en" dir="ltr" class="mw-content-ltr">Ogg multimedia (audio or video).</span> <span lang="en" dir="ltr" class="mw-content-ltr">Not an image format, but treated similarly.</span> <span lang="en" dir="ltr" class="mw-content-ltr">Often used with {{ll|Extension:TimedMediaHandler}}</span> * <code>.pdf</code> – <span lang="en" dir="ltr" class="mw-content-ltr">multipaged documents in the ''Portable Document Format'' (initially specified by ''Adobe'').</span> <span lang="en" dir="ltr" class="mw-content-ltr">Often used in conjunction with {{ll|Extension:PdfHandler}}</span> * <code>.djvu</code> – <span lang="en" dir="ltr" class="mw-content-ltr">multipaged bitmap documents in the ''DejaVu'' format (most often, scans of books).</span> <span lang="en" dir="ltr" class="mw-content-ltr">See {{ll|Manual:How to use DjVu with MediaWiki}}</span> <div lang="en" dir="ltr" class="mw-content-ltr"> *: Only a single page of a <code>.pdf</code> or <code>.djvu</code> file is shown at one time. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Other media types may be supported, but it may not be possible to display them inline. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Rendering a single image == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Syntax === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The full syntax for displaying an image is: </div> <nowiki>[[</nowiki>File:<span lang="en" dir="ltr" class="mw-content-ltr">''filename.extension''</span>|<span lang="en" dir="ltr" class="mw-content-ltr">''options''</span>|<span lang="en" dir="ltr" class="mw-content-ltr">''caption''</span><nowiki>]]</nowiki> <div lang="en" dir="ltr" class="mw-content-ltr"> where ''options'' can be empty or containing one or more of the following lower-case words, separated by pipes ('''|'''): </div> * <span lang="en" dir="ltr" class="mw-content-ltr">''[[#Format|Format]]'' option: '''border''', and one of '''frameless''', '''frame''' (or '''framed'''), or '''thumb''' (or '''thumbnail''').</span> {{Note}} <span lang="en" dir="ltr" class="mw-content-ltr">'''border''' can be used in combination with '''frameless''' but will be ignored if used with one of the other options.</span> *: <span lang="en" dir="ltr" class="mw-content-ltr">Controls how the rendered image is formatted and embedded in the rest of the page.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">''[[#Size and frame|Resizing]]'' option: one of</span> ** <span lang="en" dir="ltr" class="mw-content-ltr">''{width}'''''px''' – Resizes the image to fit within the given maximum width in pixels, without restricting its height.</span> (<span lang="en" dir="ltr" class="mw-content-ltr">Only whole-number pixel values are supported.</span> <span lang="en" dir="ltr" class="mw-content-ltr">A space character between the width value and "px" is permitted.</span>) ** <span lang="en" dir="ltr" class="mw-content-ltr">'''x'''''{height}'''''px''' – Resizes the image to fit within the given maximum height in pixels, without restricting its width.</span> <span lang="en" dir="ltr" class="mw-content-ltr">Only whole-number pixel values are supported.</span> <span lang="en" dir="ltr" class="mw-content-ltr">A space character between the height value and "px" is permitted.</span> ** <span lang="en" dir="ltr" class="mw-content-ltr">''{width}'''''x'''''{height}'''''px''' – Resizes the image to fit within the given width and height in pixels.</span> <span lang="en" dir="ltr" class="mw-content-ltr">Only whole-number pixel values are supported.</span> <span lang="en" dir="ltr" class="mw-content-ltr">A space character between the width value and "px" is permitted.</span> ** '''upright''' – <span lang="en" dir="ltr" class="mw-content-ltr">Resizes an image to a multiple of the user's thumbnail size preferences (see <code>{{ll|Manual:$wgThumbLimits|$wgThumbLimits}}</code>) – or the default thumbnail size, for logged-out users or logged-in users who have not changed their preferences – to fit within reasonable dimensions.</span> <span lang="en" dir="ltr" class="mw-content-ltr">This option is often useful for images whose height is larger than their width.</span> <span lang="en" dir="ltr" class="mw-content-ltr">Requires either '''thumb''' or '''frameless'''.</span> <span lang="en" dir="ltr" class="mw-content-ltr">Setting <code>|upright=1.0|</code> will display the image at the user's default image width.</span> <span lang="en" dir="ltr" class="mw-content-ltr"><code>|upright=2.0|</code> will display the image at double the user's default width.</span> *: <span lang="en" dir="ltr" class="mw-content-ltr">The image will always retain its aspect ratio.</span> *: <span lang="en" dir="ltr" class="mw-content-ltr">Images in non-scalable media types can be reduced in size, but not increased; e.g., bitmap images cannot be scaled up.</span> *: <span lang="en" dir="ltr" class="mw-content-ltr">The <code>upright</code> setting does not require an equals sign, i.e. <code>|upright 2.0|</code> works the same as <code>|upright=2.0|</code>.</span> *: <span lang="en" dir="ltr" class="mw-content-ltr">When used without a value or an equals sign (e.g., <code>|upright|</code>), defaults to <code>|upright=0.75|</code> (although <code>|upright=|</code> is the same as <code>|upright=1.0|</code>)</span> *: <span lang="en" dir="ltr" class="mw-content-ltr">The default maximum size depends on the ''format'' and the internal image dimensions (according to its media type).</span> * <span lang="en" dir="ltr" class="mw-content-ltr">''[[#Horizontal alignment|Horizontal alignment]]'' option: one of '''left''', '''right''', '''center''', '''none'''.</span> <span lang="en" dir="ltr" class="mw-content-ltr">If multiple of these options are present, only the first one will be used</span> *: <span lang="en" dir="ltr" class="mw-content-ltr">Controls the horizontal alignment (and inline/block or floating styles) of the image within a text (no default value).</span> * <span lang="en" dir="ltr" class="mw-content-ltr">''[[#Vertical alignment|Vertical alignment]] option'': one of '''baseline''', '''sub''', '''super''', '''top''', '''text-top''', '''middle''', '''bottom''', '''text-bottom'''</span> *: <span lang="en" dir="ltr" class="mw-content-ltr">Controls the vertical alignment of a non-floating inline image with the text before or after the image, and in the same block (the default vertical alignment is '''middle''').</span> * <span lang="en" dir="ltr" class="mw-content-ltr">''[[#Altering the default link target|Link]] option'': one of</span> ** <span lang="en" dir="ltr" class="mw-content-ltr">'''link='''''{target}'' – Allows to change the target (to an arbitrary page title, or URL) of the generated link, activable on the rendered image surface; e.g. <code><nowiki>[[File:Example.jpg|20px|link=http://www.wikipedia.org]]</nowiki></code> renders as [[File:Example.jpg|20px|link=http://www.wikipedia.org]] (external link), or <code><nowiki>[[File:Example.jpg|20px|link=MediaWiki]]</nowiki></code> renders as [[File:Example.jpg|20px|link=MediaWiki]] (internal link).</span> ** <span lang="en" dir="ltr" class="mw-content-ltr">'''link=''' (with an empty value) – ([[rev:41727|MediaWiki 1.14+]]) Displays an image without any activable link; e.g. <code><nowiki>[[File:Example.jpg|20px|link=]]</nowiki></code> renders as [[File:Example.jpg|20px|link=]].</span> *: <span lang="en" dir="ltr" class="mw-content-ltr">If there is a space character between <code>link</code> and the equals sign, the link statement will be treated as a caption.</span> *: <span lang="en" dir="ltr" class="mw-content-ltr">Including some HTML character equivalents, like <code>%22</code> for <code>"</code>, can cause the link statement to be treated as a caption (see [[phabricator:T306216]]).</span> <!--*** '''!''' Link does '''not''' work with thumb, thumbnail or frame. (This works for external and internal links)--> *: <span lang="en" dir="ltr" class="mw-content-ltr">'''!''' for MW 1.24 and lower: If you set <code>|link=|</code> (empty), then no <code>title</code> will be rendered. (See [[phabricator:T23454]].)</span> * {{Anchor|Other|other}}<span lang="en" dir="ltr" class="mw-content-ltr">Other specific options:</span> ** <span lang="en" dir="ltr" class="mw-content-ltr">'''alt='''''{alternative text}'' – ([[rev:41837|MediaWiki 1.14+]]) Defines the alternative text (maps to the HTML attribute <code>alt="..."</code> of the generated {{tag|img|single}} element) of an image that will be rendered if either the referenced image cannot be downloaded and embedded, or if the support media must use the alternative description text (e.g. when using a Braille reader or with accessibility options set by the user in its browser).</span> *: <span lang="en" dir="ltr" class="mw-content-ltr">If there is a space character between <code>alt</code> and the equals sign, the alt statement will be treated as a caption.</span> ** {{Anchor|page}}'''page='''''{number}'' – <span lang="en" dir="ltr" class="mw-content-ltr">Renders the specified page number (currently only applicable when showing a .djvu or .pdf file).</span> ** {{Anchor|thumbtime}}'''thumbtime='''''{number}'' – <span lang="en" dir="ltr" class="mw-content-ltr">Renders a thumbnail from the video at the specified timestamp in seconds or MM:SS or HH:MM:SS format (only applicable when showing a video file).</span> ** {{Anchor|start}}'''start='''''{number}'' – <span lang="en" dir="ltr" class="mw-content-ltr">When video playback is started it will start at the specified timestamp in seconds or MM:SS or HH:MM:SS format (only applicable when showing a video file).</span> ** {{Anchor|muted}}'''muted''' – <span lang="en" dir="ltr" class="mw-content-ltr">When media playback is started, audio will be muted.</span> ** {{Anchor|loop}}'''loop''' – <span lang="en" dir="ltr" class="mw-content-ltr">Media will loop continuously. (only applies to audio and video)</span> ** {{Anchor|lossy}}'''lossy='''''{false}'' – ({{ll|Extensions:PagedTiffHandler|PagedTiffHandler}}) <span lang="en" dir="ltr" class="mw-content-ltr">For using PNG instead of JPG thumbnails for Tiff images</span> ** {{Anchor|class}}'''class='''''{html class}'' – (MediaWiki 1.20+) <span lang="en" dir="ltr" class="mw-content-ltr">Defines classes (maps to the HTML attribute <code>class="..."</code> of the generated {{tag|span}} element wrapped around the {{tag|img|single}} element).</span>{{note|1=<span lang="en" dir="ltr" class="mw-content-ltr">Default behavior since MediaWiki 1.40, optional since MediaWiki 1.36.</span><ref>{{ll|Manual:$wgParserEnableLegacyMediaDOM}}</ref> <span lang="en" dir="ltr" class="mw-content-ltr">Previously the class was applied directly to the {{tag|img|single}} element.</span><ref>{{ll|Parsoid/Parser Unification/Media structure/FAQ#The %7Cclass{{=}} media option is now applied to the wrapper|<span lang="en" dir="ltr" class="mw-content-ltr">The {{!}}class{{=}} media option is now applied to the wrapper</span>}}</ref>}} ** {{Anchor|lang}}'''lang='''''{language code}'' – (MediaWiki 1.22+) <span lang="en" dir="ltr" class="mw-content-ltr">For SVG files containing [http://www.w3.org/TR/SVG/struct.html#SwitchElement <switch>] statements varying on a ''systemLanguage'' attribute, selects what language to render the file in.</span> <span lang="en" dir="ltr" class="mw-content-ltr">The default is the page language (defaults to project default language on most projects).</span> <span lang="en" dir="ltr" class="mw-content-ltr">If a parameter does not match any of the other possibilities, it is assumed to be the caption text.</span> <span lang="en" dir="ltr" class="mw-content-ltr">If more than one non-parameter string is present, the final non-parameter string will be used as the caption.</span> <span lang="en" dir="ltr" class="mw-content-ltr">Caption text shows below the image in '''thumb''' and '''frame''' formats, or as tooltip text in any other format.</span> <span lang="en" dir="ltr" class="mw-content-ltr">Caption text displayed in the '''thumb''' and '''frame''' formats may contain wiki links and other formatting.</span> <span lang="en" dir="ltr" class="mw-content-ltr">MediaWiki extensions can add additional options.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> If 'alt' is not specified and a caption is provided, the alternative text will be created automatically from the caption, stripped of formatting, except when in ''thumb'' or ''frame'' mode since the caption is already readable by screen readers in that case. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Thumbnail sizes === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> File thumbnails are stored in discrete sizes. If a page specifies a thumbnail size that's not among the [[Special:MyLanguage/common thumbnail sizes|common thumbnail sizes]] (20px, 40px, 60px, 120px, 250px, 330px, 500px, 960px, 1280px, 1920px, 3840px), then MediaWiki will pick the closest larger thumbnail size but will tell the browser to downscale it to the requested size. In these cases, nothing will change visually but users might load slightly larger images. If it doesn't matter which thumbnail size is used in a page, please pick one of the standard sizes to avoid the extra in-browser down-scaling step. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Format === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The following table shows the effect of all available formats. </div> <div class="noresize"> {|class="wikitable plainlinks" |- ! <span lang="en" dir="ltr" class="mw-content-ltr">Description</span> ! <span lang="en" dir="ltr" class="mw-content-ltr">You type</span> ! <span lang="en" dir="ltr" class="mw-content-ltr">You get</span> {{Help:Images/frame|frame=|ex=<span lang="en" dir="ltr" class="mw-content-ltr">no format specified</span>|float=no|inline=yes|render caption=no}} {{Help:Images/frame|frame=border|ex=<span lang="en" dir="ltr" class="mw-content-ltr">'''border''' results in a very small gray border</span>|float=no|inline=yes|render caption=no}} {{Help:Images/frame|frame=frameless|ex=<span lang="en" dir="ltr" class="mw-content-ltr">'''frameless''', like thumbnail, respect user preferences for image width, but without border and no right float</span>|float=no|inline=yes|render caption=no}} {{Help:Images/frame|frame=frameless|2=border|ex=<span lang="en" dir="ltr" class="mw-content-ltr">'''frameless''' and '''border'''</span>|float=no|inline=yes|render caption=no}} {{Help:Images/frame|frame=frame|ex='''frame'''|float=yes|inline=no|render caption=yes}} {{Help:Images/frame|frame=thumb|ex=<span lang="en" dir="ltr" class="mw-content-ltr">'''thumb''' or '''thumbnail'''</span>|float=yes|inline=no|render caption=yes}} |} </div> <span lang="en" dir="ltr" class="mw-content-ltr">When the height of an image in thumbnail is bigger than its width (i.e. in portrait orientation rather than landscape) and you find it too large, you may try the option <code>upright=N</code>, where N is the image's aspect ratio (its width divided by its height, defaulting to 0.75).</span> <span lang="en" dir="ltr" class="mw-content-ltr">The alternative is to specify the desired maximum height (in pixels) explicitly.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Note that by writing <code>thumb={filename}</code>, you can use a different image for the thumbnail. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Size and frame === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Among different formats, the effect of the size parameter may be different, as shown below. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> * For how it appears when its size is not specified, see [[#Format|Format]] section above. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> * When the format is not specified, or only <code>border</code>ed, the size can be both reduced and enlarged to any specified size. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> * In the examples below, the original size of the image is 400×267 pixels. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> * An image with <code>frame</code> always '''ignores''' the size specification; the original image will be reduced if it exceeds the maximum size defined in user preferences, and the page information will display a Linter error. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> * The size of an image with <code>thumb</code> or <code>frameless</code> can be reduced, but cannot be enlarged beyond the original size of the image. </div> <div class="noresize"> {|class="wikitable" |- ! <span lang="en" dir="ltr" class="mw-content-ltr">Format</span> ! <span lang="en" dir="ltr" class="mw-content-ltr">Reduced</span> ! <span lang="en" dir="ltr" class="mw-content-ltr">Enlarged</span> {{Help:Images/size|frame=}} {{Help:Images/size|frame=border}} {{Help:Images/size|frame=frame}} {{Help:Images/size|frame=thumb}} {{Help:Images/size|frame=frameless}} |} </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Horizontal alignment === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Note that when using the <code>frame</code> or <code>thumb[nail]</code> formats, the default horizontal alignment will be ''right'' for left-to-right languages, and ''left'' for right-to-left languages. </div> {|class="wikitable" |- ! <span lang="en" dir="ltr" class="mw-content-ltr">Description</span> ! <span lang="en" dir="ltr" class="mw-content-ltr">You type</span> ! <span lang="en" dir="ltr" class="mw-content-ltr">You get</span> {{Help:Images/frame|2=100px|frame=|ex=<span lang="en" dir="ltr" class="mw-content-ltr">'''no horizontal alignment specified''', or default alignment</span>|inline=yes|float=no}} {{Help:Images/frame|2=100px|frame=none|ex=<span lang="en" dir="ltr" class="mw-content-ltr">specify horizontal alignment as: '''none'''</span>|inline=no|float=no}} {{Help:Images/frame|2=100px|frame=center|ex=<span lang="en" dir="ltr" class="mw-content-ltr">specify horizontal alignment as: '''center'''</span>|inline=no|float=no}} {{Help:Images/frame|2=100px|frame=left|ex=<span lang="en" dir="ltr" class="mw-content-ltr">specify horizontal alignment as: '''left'''</span>|inline=no|float=yes}} {{Help:Images/frame|2=100px|frame=right|ex=<span lang="en" dir="ltr" class="mw-content-ltr">specify horizontal alignment as: '''right'''</span>|inline=no|float=yes}} |} <div lang="en" dir="ltr" class="mw-content-ltr"> === Vertical alignment === </div> <span lang="en" dir="ltr" class="mw-content-ltr">The vertical alignment options take effect only if the image '''is''' rendered as an inline element and '''is not''' floating.</span> <span lang="en" dir="ltr" class="mw-content-ltr">They alter the way the inlined image will be vertically aligned with the text present in the same block before and/or after this image on the same rendered row.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Note that the rendered line of text where inline images are inserted (and the lines of text rendered after the current one) may be moved down (this will increase the line-height conditionally by additional line spacing, just as it may occur with spans of text with variable font sizes, or with superscripts and subscripts) to allow the image height to be fully displayed with this alignment constraint. </div> <div class="mw-collapsible mw-collapsed"> <div class="mw-collapsible-toggle toccolours" style="float:none;text-align:center">'''{{Blue|1=<span lang="en" dir="ltr" class="mw-content-ltr">Toggle source code view</span>}}'''</div> <div class="mw-collapsible-content"> <syntaxhighlight lang="html4strict"> <p style="border:1px solid #AAA;padding:0;font-size:150%;line-height:2"> <span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> '''top:''' [[File:Example.jpg|20px|top]] [[File:Example.jpg|40px|top]] [[File:Example.jpg|100px|top]] <del>text</del></u></span></p> <p style="border:1px solid #AAA;padding:0;font-size:150%;line-height:2"> <span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> '''text-top:''' [[File:Example.jpg|20px|text-top]] [[File:Example.jpg|40px|text-top]] [[File:Example.jpg|100px|text-top]] <del>text</del></u></span></p> <p style="border:1px solid #AAA;padding:0;font-size:150%;line-height:2"> <span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> <sup>super:</sup> [[File:Example.jpg|20px|super]] [[File:Example.jpg|40px|super]] [[File:Example.jpg|100px|super]] <del>text</del></u></span></p> <p style="border:1px solid #AAA;padding:0;font-size:150%;line-height:2"> <span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> '''baseline:''' [[File:Example.jpg|20px|baseline]] [[File:Example.jpg|40px|baseline]] [[File:Example.jpg|100px|baseline]] <del>text</del></u></span></p> <p style="border:1px solid #AAA;padding:0;font-size:150%;line-height:2"> <span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> <sub>'''sub:'''</sub> [[File:Example.jpg|20px|sub]] [[File:Example.jpg|40px|sub]] [[File:Example.jpg|100px|sub]] <del>text</del></u></span></p> <p style="border:1px solid #AAA;padding:0;font-size:150%;line-height:2"> <span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> '''default:''' [[File:Example.jpg|20px]][[File:Example.jpg|40px]] [[File:Example.jpg|100px]] <del>text</del></u></span></p> <p style="border:1px solid #AAA;padding:0;font-size:150%;line-height:2"> <span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> '''middle:''' [[File:Example.jpg|20px|middle]] [[File:Example.jpg|40px|middle]] [[File:Example.jpg|100px|middle]] <del>text</del></u></span></p> <p style="border:1px solid #AAA;padding:0;font-size:150%;line-height:2"> <span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> '''text-bottom:''' [[File:Example.jpg|20px|text-bottom]] [[File:Example.jpg|40px|text-bottom]] [[File:Example.jpg|100px|text-bottom]] <del>text</del></u></span></p> <p style="border:1px solid #AAA;padding:0;font-size:150%;line-height:2"> <span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> '''bottom:'' [[File:Example.jpg|20px|bottom]] [[File:Example.jpg|40px|bottom]] [[File:Example.jpg|100px|bottom]] <del>text</del></u></span></p> </syntaxhighlight></div></div> <div lang="en" dir="ltr" class="mw-content-ltr"> To show the alignment result more clearly, the text spans are overlined and underlined, the font-size is increased to 200%, and the paragraph block is outlined with a thin border; additionally images of different sizes are aligned: </div> <p style="border:1px solid #AAA;padding:0;font-size:150%;line-height:2"> <span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> '''top:''' [[File:Example.jpg|20px|top]] [[File:Example.jpg|40px|top]] [[File:Example.jpg|100px|top]] <del>text</del></u></span></p> <p style="border:1px solid #AAA;padding:0;font-size:150%;line-height:2"> <span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> '''text-top:''' [[File:Example.jpg|20px|text-top]] [[File:Example.jpg|40px|text-top]] [[File:Example.jpg|100px|text-top]] <del>text</del></u></span></p> <p style="border:1px solid #AAA;padding:0;font-size:150%;line-height:2"> <span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> <sup>'''super:'''</sup> [[File:Example.jpg|20px|super]] [[File:Example.jpg|40px|super]] [[File:Example.jpg|100px|super]] <del>text</del></u></span></p> <p style="border:1px solid #AAA;padding:0;font-size:150%;line-height:2"> <span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> '''baseline:''' [[File:Example.jpg|20px|baseline]] [[File:Example.jpg|40px|baseline]] [[File:Example.jpg|100px|baseline]] <del>text</del></u></span></p> <p style="border:1px solid #AAA;padding:0;font-size:150%;line-height:2"> <span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> <sub>'''sub:'''</sub> [[File:Example.jpg|20px|sub]] [[File:Example.jpg|40px|sub]] [[File:Example.jpg|100px|sub]] <del>text</del></u></span></p> <p style="border:1px solid #AAA;padding:0;font-size:150%;line-height:2"> <span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> '''default:''' [[File:Example.jpg|20px]] [[File:Example.jpg|40px]] [[File:Example.jpg|100px]] <del>text</del></u></span></p> <p style="border:1px solid #AAA;padding:0;font-size:150%;line-height:2"> <span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> '''middle:''' [[File:Example.jpg|20px|middle]] [[File:Example.jpg|40px|middle]] [[File:Example.jpg|100px|middle]] <del>text</del></u></span></p> <p style="border:1px solid #AAA;padding:0;font-size:150%;line-height:2"> <span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> '''text-bottom:''' [[File:Example.jpg|20px|text-bottom]] [[File:Example.jpg|40px|text-bottom]] [[File:Example.jpg|100px|text-bottom]] <del>text</del></u></span></p> <p style="border:1px solid #AAA;padding:0;font-size:150%;line-height:2"> <span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> '''bottom:''' [[File:Example.jpg|20px|bottom]] [[File:Example.jpg|40px|bottom]] [[File:Example.jpg|100px|bottom]] <del>text</del></u></span></p> <div lang="en" dir="ltr" class="mw-content-ltr"> Notes: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">The "middle" vertical alignment position of the image (which is also the default) usually refers to the middle between the x-height and the baseline of the text (on which the vertical middle of the image will be aligned, and on which usually the text may be overstroke), but not to the middle of the line-height of the font-height that refers to the space between the "text-top" and "text-bottom" positions ; the font-height excludes:</span> #* <span lang="en" dir="ltr" class="mw-content-ltr">the additional line separation spacing normally divided equally into two line-margins (here 0.5em, according to line-height set to 200%) above and below the font-height).</span> #* <span lang="en" dir="ltr" class="mw-content-ltr">the additional line spacing which may be added by superscripts and subscripts.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">However, if the image height causes its top or bottom position to go above or below the normal full line-height of text, the middle position will be adjusted after the increasing the top and/or bottom line-margins so that the image can fit and align properly, and all images (including those with smaller heights) will be vertically centered on the adjusted middle position (for computing the effective line-height, the text of each rendered row with the larger font-height will be considered).</span> # <span lang="en" dir="ltr" class="mw-content-ltr">The "text-top" and "text-bottom" alignment positions also excludes the extra line spacing added by superscripts and subscripts, but not the additional line-spacing defined by the line-height.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">The "top" and "bottom" alignment positions take into account all these extra line spacings (including superscripts and subscripts, if they are present in a rendered line span).</span> <span lang="en" dir="ltr" class="mw-content-ltr">When the image alignment constrains the image to grow above or below the normal line-spacing, and the image is not absolutely positioned, the image will cause the "top" and "bottom" positions to be adjusted (just like superscripts and subscripts), so the effective line-height between rendered lines of text will be higher.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">The "underline", "overline" and "overstrike" text-decoration positions should be somewhere within these two limits and ''may'' depend on the type and height of fonts used (the superscript and subscript styles may be taken into account in some browsers, but usually these styles are ignored and the position of these decorations may not be adjusted); so these decorations normally don't affect the vertical position of images, relatively to the text.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Stopping the text flow === </div> <span lang="en" dir="ltr" class="mw-content-ltr">On occasion it is desirable to stop text (or other inline non-floating images) from flowing around a floating image.</span> <span lang="en" dir="ltr" class="mw-content-ltr">Depending on the web browser's screen resolution and such, text flow on the right side of an image may cause a section header (for instance, <nowiki>== My Header ==</nowiki>) to appear to the right of the image, instead of below it, as a user may expect.</span> <span lang="en" dir="ltr" class="mw-content-ltr">The text flow can be stopped by placing <syntaxhighlight lang=html inline><div style="clear: both"></div></syntaxhighlight> before the text that should start below the floating image.</span> <span lang="en" dir="ltr" class="mw-content-ltr">(This may also be done without an empty line by wrapping the section with the floating images with <syntaxhighlight lang=html inline><div style="overflow: hidden">…</div></syntaxhighlight>, which clears all floats inside the <code>div</code> element.)</span> <span lang="en" dir="ltr" class="mw-content-ltr">All images rendered as blocks (including non-floating '''center'''ed images, '''left'''- or '''right'''-floating images, as well as '''framed''' or '''thumbnail'''ed floating images) are implicitly breaking the surrounding lines of text (terminating the current block of text before the image, and creating a new paragraph for the text after them).</span> <span lang="en" dir="ltr" class="mw-content-ltr">They will then stack vertically along their left or right alignment margin (or along the center line between these margins for '''center'''ed images).</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Altering the default link target === </div> <span lang="en" dir="ltr" class="mw-content-ltr">The following table shows how to alter the link target (whose default is the image {{ll|Help:Managing files#Description page|description page}}) or how to remove it.</span> <span lang="en" dir="ltr" class="mw-content-ltr">Changing the link does not alter the format described in the previous sections.</span> <div class="noresize"> {|class="wikitable plainlinks" |- ! <span lang="en" dir="ltr" class="mw-content-ltr">Description</span> ! <span lang="en" dir="ltr" class="mw-content-ltr">You type</span> ! <span lang="en" dir="ltr" class="mw-content-ltr">You get</span> {{Help:Images/frame|2=link=Main Page|ex=<span lang="en" dir="ltr" class="mw-content-ltr">internal link</span>}} {{Help:Images/frame|2=link=http://wikipedia.org/wiki/Test|ex=<span lang="en" dir="ltr" class="mw-content-ltr">external link</span>}} {{Help:Images/frame|2=link=|ex=<span lang="en" dir="ltr" class="mw-content-ltr">no link (external or file page)</span>}} |} </div> {{note|type=warning|text='''<span lang="en" dir="ltr" class="mw-content-ltr">Warning</span>:''' : <span lang="en" dir="ltr" class="mw-content-ltr">The licencing requirements on your wiki may not allow you to remove all links to the description page that displays the required authors attributions, the copyrights statements, the applicable licencing terms, or a more complete description of the rendered image (including its history of modifications).</span> : <span lang="en" dir="ltr" class="mw-content-ltr">If you change or remove the target link of an image, you will then have to provide somewhere else on your page an explicit link to this description page, or to display the copyright and author statement and a link to the applicable licence, if they are different from the elements applicable to the embedding page itself.</span> : <span lang="en" dir="ltr" class="mw-content-ltr">Your wiki policy may restrict the use of the alternate link parameter, or may even enforce a prohibition of alternate link parameters for embedded media files (in which case, the link parameter will be ignored), or may only accept them after validation by authorized users or administrators.</span>}} <div lang="en" dir="ltr" class="mw-content-ltr"> == Rendering a gallery of images == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Gallery syntax === </div> <span lang="en" dir="ltr" class="mw-content-ltr">It's easy to make a gallery of thumbnails with the {{tag|gallery|open}} tag.</span> <span lang="en" dir="ltr" class="mw-content-ltr">The syntax is:</span> <syntaxhighlight lang=wikitext> <gallery> File:file_name.ext|caption|alt=alt language File:file_name.ext|caption|alt=alt language {...} </gallery> </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Note that the image code is not enclosed in brackets when enclosed in gallery tags. </div> <span lang="en" dir="ltr" class="mw-content-ltr">Captions are optional, and may contain wiki links or other formatting.</span> {{note|1=<span lang="en" dir="ltr" class="mw-content-ltr">The words "center", "left", and "right" used as captions cause false-positive Linter errors.</span> <span lang="en" dir="ltr" class="mw-content-ltr">See {{phab|T275074}} for details.</span>}} <span lang="en" dir="ltr" class="mw-content-ltr">Some of the parameters controlling thumb output can also be used here, specifically the ones that modify the file (as opposed to ones that control where in the page the image falls).</span> <span lang="en" dir="ltr" class="mw-content-ltr">For example, with multi-paged media like pdfs, you can use code like <code>page=4</code> and with videos you can use <code>thumbtime=10</code>.</span> <span lang="en" dir="ltr" class="mw-content-ltr">The <code>File:</code> prefix can be omitted.</span> <span lang="en" dir="ltr" class="mw-content-ltr">However, it is helpful to include it as an aid for quickly locating image specifiers in the wikitext (for example, when cleaning up page layout).</span> <div lang="en" dir="ltr" class="mw-content-ltr"> If the image links to an external site, the caption must come ''before'' the link parameter or the caption will not render. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example: </div> <syntaxhighlight lang="wikitext"> <gallery> File:Example.jpg|Item 1 File:Example.jpg|a link to [[Help:Contents]] File:Example.jpg File:Example.jpg|alt=An example image. It has flowers File:Example.jpg|''italic caption'' File:Example.jpg|link=https://example.com|This text will not render because an external link came first File:Example.jpg|Links to external website|link=https://example.com File:Example.jpg|link=w:Main_Page|Internal link Example.jpg|on page "{{PAGENAME}}" File:Using Firefox.pdf|page=72 </gallery> </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> is formatted as: </div> <gallery> File:Example.jpg|<span lang="en" dir="ltr" class="mw-content-ltr">Item 1</span> File:Example.jpg|<span lang="en" dir="ltr" class="mw-content-ltr">a link to [[Help:Contents]]</span> File:Example.jpg File:Example.jpg|alt=<span lang="en" dir="ltr" class="mw-content-ltr">An example image. It has flowers</span> File:Example.jpg|''<span lang="en" dir="ltr" class="mw-content-ltr">italic caption</span>'' File:Example.jpg|link=https://example.com|<span lang="en" dir="ltr" class="mw-content-ltr">This text will not render because an external link came first</span> File:Example.jpg|<span lang="en" dir="ltr" class="mw-content-ltr">Links to external website</span>|link=https://example.com File:Example.jpg|link=w:Main_Page|<span lang="en" dir="ltr" class="mw-content-ltr">Internal link</span> Example.jpg|on page "{{PAGENAME}}" File:Using Firefox.pdf|page=72 </gallery> <div lang="en" dir="ltr" class="mw-content-ltr"> === mode parameter === </div> {{MW 1.22|and after}} <div lang="en" dir="ltr" class="mw-content-ltr"> Starting in MediaWiki version 1.22 a <code>mode</code> parameter is available, taking options as follows: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> * <code>traditional</code> is the original gallery type used by MediaWiki. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> * <code>nolines</code> is similar to <code>traditional</code>, but with no border lines. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> * <code>packed</code> causes images to have the same height but different widths, with little space between the images. </div> <span lang="en" dir="ltr" class="mw-content-ltr">The rows in this [[w:Responsive web design|responsive]] mode organize themselves according to the width of the screen regardless of default gallery settings.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> * <code>packed-overlay</code> shows the caption overlaid on the image, in a semi-transparent white box. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> * <code>packed-hover</code> is similar to <code>packed-overlay</code>, but with the caption and box only showing up on hover. </div> * <span lang="en" dir="ltr" class="mw-content-ltr"><code>slideshow</code> creates a slideshow of the images.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> For example: </div> <syntaxhighlight lang="tid"> <gallery mode="packed-hover"> File:Astronotus_ocellatus.jpg|''[[commons:Astronotus ocellatus|Astronotus ocellatus]]'' (Oscar) File:Salmonlarvakils.jpg|''[[commons:Salmo salar|Salmo salar]]'' (Salmon Larva) File:Georgia Aquarium - Giant Grouper.jpg|''[[commons:Epinephelus lanceolatus|Epinephelus lanceolatus]]'' (Giant grouper) File:Pterois volitans Manado-e.jpg|''[[commons:Pterois volitans|Pterois volitans]]'' (Red Lionfish) File:Macropodus opercularis - front (aka).jpg|''[[commons:Macropodus opercularis|Macropodus opercularis]]'' (Paradise fish) File:Canthigaster valentini 1.jpg|''[[commons:Canthigaster valentini|Canthigaster valentini]]'' (Valentinni's sharpnose puffer) File:Flughahn.jpg|[[File:POTY ribbon 2007.svg|25px]] ''[[commons:Dactylopterus volitans|Dactylopterus volitans]]'' (Flying gurnard) File:Fishmarket 01.jpg|''[[commons:Semicossyphus pulcher|Semicossyphus pulcher]]'' (California Sheephead) File:Pseudorasbora parva(edited version).jpg|''[[commons:Category:Pseudorasbora parva|Pseudorasbora parva]]'' (Topmouth gudgeon) File:MC Rotfeuerfisch.jpg|''[[commons:Category:Pterois antennata|Pterois antennata]]'' (Antennata Lionfish) File:Cleaning station konan.jpg|''[[commons:Novaculichthys taeniourus|Novaculichthys taeniourus]]'' File:Synchiropus splendidus 2 Luc Viatour.jpg|''[[commons:Synchiropus splendidus|Synchiropus splendidus]]'' (Mandarin fish) File:Psetta maxima Luc Viatour.jpg|''[[commons:Psetta maxima|Psetta maxima]]'' (Turbot) File:Australian blenny.jpg|''[[commons:Category:Ecsenius|Ecsenius axelrodi]]'' </gallery> </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Gives (mode: <code>packed-hover</code>): </div> <gallery mode="packed-hover"> File:Astronotus_ocellatus.jpg|''[[commons:Astronotus ocellatus|Astronotus ocellatus]]'' (Oscar) File:Salmonlarvakils.jpg|''[[commons:Salmo salar|Salmo salar]]'' (Salmon Larva) File:Georgia Aquarium - Giant Grouper.jpg|''[[commons:Epinephelus lanceolatus|Epinephelus lanceolatus]]'' (Giant grouper) File:Pterois volitans Manado-e.jpg|''[[commons:Pterois volitans|Pterois volitans]]'' (Red Lionfish) File:Macropodus opercularis - front (aka).jpg|''[[commons:Macropodus opercularis|Macropodus opercularis]]'' (Paradise fish) File:Canthigaster valentini 1.jpg|''[[commons:Canthigaster valentini|Canthigaster valentini]]'' (Valentinni's sharpnose puffer) File:Flughahn.jpg|[[File:POTY ribbon 2007.svg|25px]] ''[[commons:Dactylopterus volitans|Dactylopterus volitans]]'' (Flying gurnard) File:California Sheephead (Semicossyphus pulcher) at Ensenada's fishmarket.jpg|''[[commons:Semicossyphus pulcher|Semicossyphus pulcher]]'' (California Sheephead) File:Pseudorasbora parva(edited version).jpg|''[[commons:Category:Pseudorasbora parva|Pseudorasbora parva]]'' (Topmouth gudgeon) File:MC Rotfeuerfisch.jpg|''[[commons:Category:Pterois antennata|Pterois antennata]]'' (Antennata Lionfish) File:Cleaning station konan.jpg|''[[commons:Novaculichthys taeniourus|Novaculichthys taeniourus]]'' File:Synchiropus splendidus 2 Luc Viatour.jpg|''[[commons:Synchiropus splendidus|Synchiropus splendidus]]'' (Mandarin fish) File:Psetta maxima Luc Viatour.jpg|''[[commons:Psetta maxima|Psetta maxima]]'' (Turbot) File:Australian blenny.jpg|''[[commons:Category:Ecsenius|Ecsenius axelrodi]]'' </gallery> <div lang="en" dir="ltr" class="mw-content-ltr"> Examples of the other modes: </div> <code>mode="traditional"</code> <gallery mode="traditional"> File:Astronotus_ocellatus.jpg|''[[commons:Astronotus ocellatus|Astronotus ocellatus]]'' (Oscar) File:Salmonlarvakils.jpg|''[[commons:Salmo salar|Salmo salar]]'' (Salmon Larva) File:Georgia Aquarium - Giant Grouper.jpg|''[[commons:Epinephelus lanceolatus|Epinephelus lanceolatus]]'' (Giant grouper) </gallery> <code>mode="nolines"</code> <gallery mode="nolines"> File:Astronotus_ocellatus.jpg|''[[commons:Astronotus ocellatus|Astronotus ocellatus]]'' (Oscar) File:Salmonlarvakils.jpg|''[[commons:Salmo salar|Salmo salar]]'' (Salmon Larva) File:Georgia Aquarium - Giant Grouper.jpg|''[[commons:Epinephelus lanceolatus|Epinephelus lanceolatus]]'' (Giant grouper) </gallery> <code>mode="packed"</code> <gallery mode="packed"> File:Astronotus_ocellatus.jpg|''[[commons:Astronotus ocellatus|Astronotus ocellatus]]'' (Oscar) File:Salmonlarvakils.jpg|''[[commons:Salmo salar|Salmo salar]]'' (Salmon Larva) File:Georgia Aquarium - Giant Grouper.jpg|''[[commons:Epinephelus lanceolatus|Epinephelus lanceolatus]]'' (Giant grouper) </gallery> <code>mode="packed-overlay"</code> <gallery mode="packed-overlay"> File:Astronotus_ocellatus.jpg|''[[commons:Astronotus ocellatus|Astronotus ocellatus]]'' (Oscar) File:Salmonlarvakils.jpg|''[[commons:Salmo salar|Salmo salar]]'' (Salmon Larva) File:Georgia Aquarium - Giant Grouper.jpg|''[[commons:Epinephelus lanceolatus|Epinephelus lanceolatus]]'' (Giant grouper) </gallery> <code>mode="packed-hover"</code> <gallery mode="packed-hover"> File:Astronotus_ocellatus.jpg|''[[commons:Astronotus ocellatus|Astronotus ocellatus]]'' (Oscar) File:Salmonlarvakils.jpg|''[[commons:Salmo salar|Salmo salar]]'' (Salmon Larva) File:Georgia Aquarium - Giant Grouper.jpg|''[[commons:Epinephelus lanceolatus|Epinephelus lanceolatus]]'' (Giant grouper) </gallery> {{MW 1.28|and after}} <code id="slideshow-demo">mode="slideshow"</code> <gallery mode="slideshow"> File:Astronotus_ocellatus.jpg|''[[commons:Astronotus ocellatus|Astronotus ocellatus]]'' (Oscar) File:Salmonlarvakils.jpg|''[[commons:Salmo salar|Salmo salar]]'' (Salmon Larva) File:Georgia Aquarium - Giant Grouper.jpg|''[[commons:Epinephelus lanceolatus|Epinephelus lanceolatus]]'' (Giant grouper) File:Pterois volitans Manado-e.jpg|''[[commons:Pterois volitans|Pterois volitans]]'' (Red Lionfish) File:Macropodus opercularis - front (aka).jpg|''[[commons:Macropodus opercularis|Macropodus opercularis]]'' (Paradise fish) File:Canthigaster valentini 1.jpg|''[[commons:Canthigaster valentini|Canthigaster valentini]]'' (Valentinni's sharpnose puffer) File:Flughahn.jpg|[[File:POTY ribbon 2007.svg|25px]] ''[[commons:Dactylopterus volitans|Dactylopterus volitans]]'' (Flying gurnard) File:California Sheephead (Semicossyphus pulcher) at Ensenada's fishmarket.jpg|''[[commons:Semicossyphus pulcher|Semicossyphus pulcher]]'' (California Sheephead) File:Pseudorasbora parva(edited version).jpg|''[[commons:Category:Pseudorasbora parva|Pseudorasbora parva]]'' (Topmouth gudgeon) File:MC Rotfeuerfisch.jpg|''[[commons:Category:Pterois antennata|Pterois antennata]]'' (Antennata Lionfish) File:Cleaning station konan.jpg|''[[commons:Novaculichthys taeniourus|Novaculichthys taeniourus]]'' File:Synchiropus splendidus 2 Luc Viatour.jpg|''[[commons:Synchiropus splendidus|Synchiropus splendidus]]'' (Mandarin fish) File:Psetta maxima Luc Viatour.jpg|''[[commons:Psetta maxima|Psetta maxima]]'' (Turbot) File:Australian blenny.jpg|''[[commons:Category:Ecsenius|Ecsenius axelrodi]]'' </gallery> <div lang="en" dir="ltr" class="mw-content-ltr"> === Optional gallery attributes === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The gallery tag itself takes several additional parameters, specified as attribute name-value pairs: </div> <syntaxhighlight lang=html> <gallery {parameters}> {images} </gallery> </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> * <code>caption="{caption}"</code>: (caption text between double quotes for more than one word) sets a caption centered atop the gallery. Only plain text may be used in the caption; formatting, templates and the like will not work. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> * <code>widths={width}</code>: sets the (max) widths of the images in pixels; the [[Special:MyLanguage/Manual:$wgGalleryOptions|default value]] is 120px. </div> <span lang="en" dir="ltr" class="mw-content-ltr">(It has no effect if mode is set to one of the following: packed, packed-overlay, packed-hover, slideshow.)</span> ''<span lang="en" dir="ltr" class="mw-content-ltr">Note the plural: width'''s'''</span>''. <div lang="en" dir="ltr" class="mw-content-ltr"> * <code>heights={heights}</code>: sets the (max) heights of the images in pixels; the default value is 120px. </div> <span lang="en" dir="ltr" class="mw-content-ltr">(It has no effect if mode is set to slideshow.)</span> <div lang="en" dir="ltr" class="mw-content-ltr"> * <code>perrow={integer}</code>: sets the number of images per row. </div> <span lang="en" dir="ltr" class="mw-content-ltr">(It has no effect if mode is set to one of the following: packed, packed-overlay, packed-hover, slideshow.)</span> <span lang="en" dir="ltr" class="mw-content-ltr">The default is <code>perrow=0</code> which automatically adjusts the number of images per row based on width of screen.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> * <code>showfilename={anything}</code>: Show the filenames of the images in the individual captions for each image (1.17+). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> * <code>mode={traditional|nolines|packed|packed-hover|packed-overlay|slideshow}</code>: See section above (1.22+; 1.28+ for "slideshow"). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> * <code>showthumbnails</code>: For "slideshow" mode only, display the strip with image thumbnails below the slideshow by default (1.29+). </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Any html attribute allowed on a <code><ul></code> tag (e.g. <code>id</code>, <code>title</code>, <code>class</code>)</span> {{note|1=<span lang="en" dir="ltr" class="mw-content-ltr">In packed (and related) modes, the widths parameter has no effect; instead, the heights parameter determines the minimum height of the images.</span> <span lang="en" dir="ltr" class="mw-content-ltr">Packed modes adjust the width of images to ensure that each row is of equal length, except when a row contains too few images to achieve this without excessively enlarging the images.</span>}} <div lang="en" dir="ltr" class="mw-content-ltr"> ; Example 1 </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Syntax: </div> <syntaxhighlight lang=html> <gallery widths=300 heights=200> File:Example.jpg|Lorem ipsum File:Example.jpg|Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut </gallery> </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Result: </div> <gallery widths="300" heights="200"> File:Example.jpg|Lorem ipsum File:Example.jpg|Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut </gallery> <div lang="en" dir="ltr" class="mw-content-ltr"> ; Example 2 </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Syntax: </div> <syntaxhighlight lang=html> <gallery widths=60 heights=60 perrow=7 caption="sunflowers are groovy"> File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg </gallery> </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Result: </div> <gallery widths="60" heights="60" perrow="7" caption="{{Tunit|288|sunflowers are groovy}}"> File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg </gallery> <div lang="en" dir="ltr" class="mw-content-ltr"> == Row of images that will wrap to browser width == </div> <span lang="en" dir="ltr" class="mw-content-ltr">One way that works for a row of images with varying widths is not to use "thumb" or "left" or "none".</span> <span lang="en" dir="ltr" class="mw-content-ltr">If "thumb" is not used (and thus no captions) a row of images will wrap to the browser width.</span> <span lang="en" dir="ltr" class="mw-content-ltr">If necessary, narrow the browser window to see the images wrap to the next row.</span> <pre> [[File:Example.jpg|220px]] [[File:Example.jpg|100px]] [[File:Example.jpg|150px]] [[File:Example.jpg|250px]] [[File:Example.jpg|200px]] [[File:Example.jpg|50px]] [[File:Example.jpg|220px]] [[File:Example.jpg|175px]] </pre> [[File:Example.jpg|220px]] [[File:Example.jpg|100px]] [[File:Example.jpg|150px]] [[File:Example.jpg|250px]] [[File:Example.jpg|200px]] [[File:Example.jpg|50px]] [[File:Example.jpg|220px]] [[File:Example.jpg|175px]] <div lang="en" dir="ltr" class="mw-content-ltr"> '''To wrap images of varying widths with captions''' it is necessary to use div HTML for an unordered list. Along with <code>style="display: inline-block;"</code>. For more info and ideas see: [https://www.sitepoint.com/give-floats-the-flick-in-css-layouts/ Give Floats the Flick in CSS Layouts]. </div> <syntaxhighlight lang="html"> <div><ul> <li style="display: inline-block;"> [[File:Example.jpg|thumb|none|220px|Caption 1]] </li> <li style="display: inline-block;"> [[File:Example.jpg|thumb|none|100px|Caption 2]] </li> <li style="display: inline-block;"> [[File:Example.jpg|thumb|none|150px|Caption 3]] </li> <li style="display: inline-block;"> [[File:Example.jpg|thumb|none|250px|Caption 4]] </li> <li style="display: inline-block;"> [[File:Example.jpg|thumb|none|200px|Caption 5]] </li> <li style="display: inline-block;"> [[File:Example.jpg|thumb|none|50px|Caption 6]] </li> <li style="display: inline-block;"> [[File:Example.jpg|thumb|none|220px|Caption 7]] </li> <li style="display: inline-block;"> [[File:Example.jpg|thumb|none|175px|Caption 8]] </li> </ul></div> </syntaxhighlight> <div><ul> <li style="display: inline-block;"> [[File:Example.jpg|thumb|none|220px|Caption 1]] </li> <li style="display: inline-block;"> [[File:Example.jpg|thumb|none|100px|Caption 2]] </li> <li style="display: inline-block;"> [[File:Example.jpg|thumb|none|150px|Caption 3]] </li> <li style="display: inline-block;"> [[File:Example.jpg|thumb|none|250px|Caption 4]] </li> <li style="display: inline-block;"> [[File:Example.jpg|thumb|none|200px|Caption 5]] </li> <li style="display: inline-block;"> [[File:Example.jpg|thumb|none|50px|Caption 6]] </li> <li style="display: inline-block;"> [[File:Example.jpg|thumb|none|220px|Caption 7]] </li> <li style="display: inline-block;"> [[File:Example.jpg|thumb|none|175px|Caption 8]] </li> </ul></div> <span lang="en" dir="ltr" class="mw-content-ltr">To '''align the top edge of images''' add the vertical-align command</span> <syntaxhighlight lang="html"> <div><ul> <li style="display: inline-block; vertical-align: top;"> [[File:Example.jpg|thumb|none|220px|Caption 1]] </li> <li style="display: inline-block; vertical-align: top;"> [[File:Example.jpg|thumb|none|100px|Caption 2]] </li> <li style="display: inline-block; vertical-align: top;"> [[File:Example.jpg|thumb|none|150px|Caption 3]] </li> <li style="display: inline-block; vertical-align: top;"> [[File:Example.jpg|thumb|none|250px|Caption 4]] </li> <li style="display: inline-block; vertical-align: top;"> [[File:Example.jpg|thumb|none|200px|Caption 5]] </li> <li style="display: inline-block; vertical-align: top;"> [[File:Example.jpg|thumb|none|50px|Caption 6]] </li> <li style="display: inline-block; vertical-align: top;"> [[File:Example.jpg|thumb|none|220px|Caption 7]] </li> <li style="display: inline-block; vertical-align: top;"> [[File:Example.jpg|thumb|none|175px|Caption 8]] </li> </ul></div> </syntaxhighlight> <div><ul> <li style="display: inline-block; vertical-align: top;"> [[File:Example.jpg|thumb|none|220px|Caption 1]] </li> <li style="display: inline-block; vertical-align: top;"> [[File:Example.jpg|thumb|none|100px|Caption 2]] </li> <li style="display: inline-block; vertical-align: top;"> [[File:Example.jpg|thumb|none|150px|Caption 3]] </li> <li style="display: inline-block; vertical-align: top;"> [[File:Example.jpg|thumb|none|250px|Caption 4]] </li> <li style="display: inline-block; vertical-align: top;"> [[File:Example.jpg|thumb|none|200px|Caption 5]] </li> <li style="display: inline-block; vertical-align: top;"> [[File:Example.jpg|thumb|none|50px|Caption 6]] </li> <li style="display: inline-block; vertical-align: top;"> [[File:Example.jpg|thumb|none|220px|Caption 7]] </li> <li style="display: inline-block; vertical-align: top;"> [[File:Example.jpg|thumb|none|175px|Caption 8]] </li> </ul></div> <span lang="en" dir="ltr" class="mw-content-ltr">Some wiki farms do not have all gallery options (such as "widths").</span> <span lang="en" dir="ltr" class="mw-content-ltr">Also, sometimes one wants varying widths for images in a row.</span> <span lang="en" dir="ltr" class="mw-content-ltr">Outside of a gallery, or the div HTML, it is impossible to have individual captions for images in a row of images that will wrap to the browser width.</span> <span lang="en" dir="ltr" class="mw-content-ltr">Try it and see. Nothing else using wikitext works correctly. Images will either overlap stuff on the right, or force a horizontal scroll bar.</span> <span lang="en" dir="ltr" class="mw-content-ltr">Using a left float ("left") for some images, combined with "none" for some of the images, will not work consistently either, especially if there is also a right sidebar of images.</span> <span lang="en" dir="ltr" class="mw-content-ltr">Weird things will occur.</span> <span lang="en" dir="ltr" class="mw-content-ltr">At narrower browser or screen widths an image out of the row may appear far down the page after the end of the right sidebar of images.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> == Link behavior == </div> <span lang="en" dir="ltr" class="mw-content-ltr">By default an image links to its file description page.</span> <span lang="en" dir="ltr" class="mw-content-ltr">The "link=" option modifies this behavior to link to another page or website, or to turn off the image's linking behavior.</span> <span lang="en" dir="ltr" class="mw-content-ltr">Alternatively, you can create a text link to a file description page or to the file itself.</span> <span lang="en" dir="ltr" class="mw-content-ltr">See {{ll|Help:Linking to files}}.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Display image, link it to another page or website === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Use the "link=" option to link an image to another page or website: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Clicking on the below image will take you to [[MediaWiki]]: </div> <nowiki>[[File:MediaWiki-2020-logo.svg|50px|link=MediaWiki]]</nowiki> [[File:MediaWiki-2020-logo.svg|50px|link=MediaWiki]] <div lang="en" dir="ltr" class="mw-content-ltr"> Clicking on the below image will take you to ''example.com'': </div> <nowiki>[[File:MediaWiki-2020-logo.svg|50px|link=http://example.com]]</nowiki> [[File:MediaWiki-2020-logo.svg|50px|link=http://example.com]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Display image, turn off link === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Use the "link=" option with no value assigned to turn the link off entirely; the below image is not a link: </div> <nowiki>[[File:MediaWiki-2020-logo.svg|50px|link=]]</nowiki> [[File:MediaWiki-2020-logo.svg|50px|link=]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Link to an image === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Add <code>:</code> as a prefix to the link you need to create. </div> <nowiki>[[:File:MediaWiki-2020-logo.svg]]</nowiki> [[:File:MediaWiki-2020-logo.svg]] <nowiki>[[:File:MediaWiki-2020-logo.svg|Wiki]]</nowiki> [[:File:MediaWiki-2020-logo.svg|Wiki]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Directly linking to an image === </div> <span lang="en" dir="ltr" class="mw-content-ltr">The above examples link to the image's description page.</span> <span lang="en" dir="ltr" class="mw-content-ltr">To directly link to an image, the pseudo-namespace <code>Media:</code> can be used on MediaWiki pages:</span> <syntaxhighlight lang="wikitext"> [[Media:MediaWiki-2020-logo.svg]] </syntaxhighlight> [[Media:MediaWiki-2020-logo.svg]] {{anchor|Direct image access}} <div lang="en" dir="ltr" class="mw-content-ltr"> ====Direct links from external sites==== </div> <span lang="en" dir="ltr" class="mw-content-ltr">Another possibility is to use the [[Special:Redirect/file]] page (or its alias [[Special:Filepath]]).</span> <span lang="en" dir="ltr" class="mw-content-ltr">Unlike the above example, you can link to it from external websites as well as from MediaWiki pages.</span> <syntaxhighlight lang="wikitext"> [[Special:Redirect/file/Wikipedia.png]] </syntaxhighlight> <span lang="en" dir="ltr" class="mw-content-ltr">The parameters <code>height</code> and <code>width</code> can also be added to return a specific size of the image.</span> <span lang="en" dir="ltr" class="mw-content-ltr">The image aspect ratio is always preserved.</span> <nowiki>https://www.mediawiki.org/w/index.php?title=Special:Redirect/file/Wikipedia.png&width=100&height=100</nowiki> {{anchor|Obtain a direct link to an image}} <div lang="en" dir="ltr" class="mw-content-ltr"> ====Obtaining the full URL of an image==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To obtain the full path of an image (without going through redirects as shown above), some {{ll|Help:magic words|nsp=0}} can be used. </div> <nowiki>{{filepath:MediaWiki-2020-logo.svg}}</nowiki> <span lang="en" dir="ltr" class="mw-content-ltr">Becomes:</span> :{{filepath:MediaWiki-2020-logo.svg}} <span lang="en" dir="ltr" class="mw-content-ltr">In the event that this is used from a template where the <code>File:</code> namespace needs to be removed, <code><nowiki>{{PAGENAME}}</nowiki></code> can do so:</span> <nowiki>{{filepath:{{PAGENAME:File:MediaWiki-2020-logo.svg}}}}</nowiki> <span lang="en" dir="ltr" class="mw-content-ltr">Becomes:</span> :{{filepath:{{PAGENAME:File:MediaWiki-2020-logo.svg}}}} <div lang="en" dir="ltr" class="mw-content-ltr"> == Files at other websites == </div> <span lang="en" dir="ltr" class="mw-content-ltr">You can link to an external file available online using the same syntax used for linking to an external web page.</span> <span lang="en" dir="ltr" class="mw-content-ltr">With these syntaxes, the image will not be rendered, but only the text of the link to this image will be displayed.</span> <pre>[http://url.for/some/image.png]</pre> <div lang="en" dir="ltr" class="mw-content-ltr"> Or with a different displayed text: </div> <pre>[http://url.for/some/image.png link text here]</pre> <div lang="en" dir="ltr" class="mw-content-ltr"> Additional MediaWiki markup or HTML/CSS formatting (for inline elements) is permitted in this displayed text (except for embedded links that would break the surrounding link): </div> <pre>[http://www.example.com/some/image.png Example '''<del>rich</del>''' ''<ins>link text</ins>'' here.]</pre> <div lang="en" dir="ltr" class="mw-content-ltr"> which renders as: </div> [http://www.example.com/some/image.png <span lang="en" dir="ltr" class="mw-content-ltr">Example '''<del>rich</del>''' ''<ins>link text</ins>'' here.</span>] <div lang="en" dir="ltr" class="mw-content-ltr"> If it is enabled on your wiki (see {{ll|Manual:$wgAllowExternalImages}}), you can also embed external images. To do that, simply insert the image's URL: </div> <pre>http://url.for/some/image.png</pre> <div lang="en" dir="ltr" class="mw-content-ltr"> Embedded images can be resized by the CSS <code>transform</code> property. They also may be formatted by surrounding MediaWiki markup or HTML/CSS code. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If this wiki option is not enabled, the image will not be embedded but rendered as a textual link to the external site, just like above, unless the site's {{ll|Manual:$wgAllowExternalImagesFrom}} has a value. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> It is also possible to use {{ll|InstantCommons}} or other {{ll|Manual:$wgForeignFileRepos|shared file repositories}} to load files from other wikis, which are treated as if they were local images. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == See also == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> *[[w:Wikipedia:Extended image syntax|Wikipedia:Extended image syntax]] *[[w:Category:Wikipedia image help|Category:Wikipedia image help]] *[[w:Wikipedia:Picture tutorial|Wikipedia:Picture tutorial]] *[[w:Help:Gallery tag]] </div> *{{ll|Manual:Adding support for new filetypes}} *[[phab:T113101]] – <span lang="en" dir="ltr" class="mw-content-ltr">responsive issues</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[Special:MyLanguage/Extension:PageImages#Can I exclude certain page images?|Extension:PageImages#Can I exclude certain page images?]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> == References == </div> <references/> [[Category:Help{{#translation:}}|Images]]
Search
Search
Export translations
Add topic