Jump to content

英文维基 | 中文维基 | 日文维基 | 草榴社区

Wikipedia:Autosizing images

From Wikipedia, the free encyclopedia

The following are techniques to auto-size, or scale, any image ("thumb" or "frameless"), based on each user's default thumbnail size (220px for those not logged in or for those who have not changed it at Special:Preferences). Within an image link, the options are as follows:

  • thumb – displays the image as a framed thumbnail at the user's default size
  • frameless – displays the image as an unframed at the user's default size
  • upright – scales the image to approximately 75% of the user's default size (25% smaller)
  • upright=0.8 – scales the image to approximately 80% of the user's default size (20% smaller)
  • upright=1.2 – scales the image to approximately 120% of the user's default size (20% larger)
  • left – shifts the image to the left margin
  • right – shifts the image to the right margin
  • center – shifts the image to center between left/right margins

Each of the above sizing options can be used in any image link coded into a Wikipedia page, in the form [[File:Example.jpg|thumb|upright|left|Description]]. When a user views the page, the image will be resized based on the user's default image size setting.

Effects of upright

[edit]

The available values for thumbnail size in Preferences (on the Appearance tab) are 120px, 150px, 180px, 200px, 220px (default), 250px, 300px, and 400px. As explained at Wikipedia:Extended image syntax § Size, upright=Factor will "adjust a thumbnail's size to Factor times the default thumbnail size, rounding the result to the nearest multiple of 10". That can be calculated on Wikipedia via {{#expr: SIZE * FACTOR round -1}}, which is how the following table was generated.

Effects of upright on image widths available in user preferences
120px 150px 180px 200px 220px
(default)
250px 300px 400px
upright=0.3 40px 50px 50px 60px 70px 80px 90px 120px
upright=0.6 70px 90px 110px 120px 130px 150px 180px 240px
upright=0.75
upright
90px 110px 140px 150px 170px 190px 230px 300px
upright=0.8 100px 120px 140px 160px 180px 200px 240px 320px
upright=0.85 100px 130px 150px 170px 190px 210px 260px 340px
upright=0.9 110px 140px 160px 180px 200px 230px 270px 360px
upright=0.95 110px 140px 170px 190px 210px 240px 290px 380px
upright=1 120px 150px 180px 200px 220px 250px 300px 400px
upright=1.05 130px 160px 190px 210px 230px 260px 320px 420px
upright=1.1 130px 170px 200px 220px 240px 280px 330px 440px
upright=1.15 140px 170px 210px 230px 250px 290px 350px 460px
upright=1.2 140px 180px 220px 240px 260px 300px 360px 480px
upright=1.25 150px 190px 230px 250px 280px 310px 380px 500px
upright=1.3 160px 200px 230px 260px 290px 330px 390px 520px
upright=1.35 160px 200px 240px 270px 300px 340px 410px 540px
upright=1.5 180px 230px 270px 300px 330px 380px 450px 600px
upright=1.8 220px 270px 320px 360px 400px 450px 540px 720px

Examples

[edit]

thumb, frameless, upright

[edit]

The following examples use the "thumb" or "frameless" options to set an image to the default size, with "upright" to scale the image larger or smaller than the default size. When using these options, a small image will never be scaled larger than its original size.

Options used Large image Small image
|thumb
|thumb|upright=1.35
|thumb|upright=0.3
|frameless
|frameless|upright=1.35
|frameless|upright=0.3

In the examples above, the size of the image is scaled based on each user's default image size, which can be changed at Special:Preferences. Setting image size in pixels, such as "250px", would override the user's preference and display the image as 250px wide for all users who view that image on that page.

left, right, center

[edit]

As shown in the prior examples, "thumb" defaults to right aligned, while "frameless" defaults to left aligned. This can be changed by using "left", "right", or "center". The following examples include lorem ipsum text before (in red) and after (in green) to show how it wraps around the image.

Alignment thumb frameless
left Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
right Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
center Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Purpose of autosizing

[edit]

Because many users have begun viewing Wikipedia articles on various smaller devices, not just desktop PC computers, the autosizing of images will allow each user to view those images as smaller pictures on handheld devices, such as laptops, notebook or tablet computers, and some mobile phones. The users can set their Special:Preferences to select their default image size (such as: 250px, 180px, or 120px), for whichever handheld device they use for viewing Wikipedia pages. Autosizing of images will also allow sight-impaired users, per WP:Access, to enlarge their default image-size (such as 300px) to perhaps see details more clearly.

See also

[edit]
[ This essay is a quick draft to be expanded later. ]