]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - doc/todo/img_tag_should_support_relative_size.mdwn
rename bugs/img_tag_should_support_relative_size.mdwn to todo/img_tag_should_support_...
[git.ikiwiki.info.git] / doc / todo / img_tag_should_support_relative_size.mdwn
1 The size parameter should accept relative values, like "100%". When including large images, I would like it to be scaled relative to the available space.
3 > 100% of what?
4 >
5 > The purpose of `[[!img]]` is to scale large images, for example photos, down
6 > to a more web-suitable size. When ikiwiki rebuilds the website, it cannot
7 > know how large visitors' web browser windows are going to be, so it cannot
8 > scale the image relative to the size of a visitor's web browser window.
9 >
10 > The closest thing it could do would be to not scale the image at all
11 > (potentially a very large download if it's a high-resolution photo),
12 > and use CSS or `<img sizes=...>` to ask the visitor's web browser to scale
13 > the image relative to something the web browser knows, such as the viewport
14 > size.
15 >
16 > With HTML5 `<img sizes="..." srcset="...">`, it would be possible to extend
17 > `[[!img]]` to produce more than one resized image and let the visitor's
18 > browser choose which one to download, but I'm not sure what a good syntax
19 > for that would look like...
20 >
21 > "The available space" is not something we can use, because current HTML
22 > standards do not offer that. In HTML5 it is possible to base sizes on the
23 > viewport (window) size, but the available space (excluding sidebars etc.)
24 > is not something the browser can know in advance, because it needs to know
25 > how large images are before it carries out layout calculations, and it
26 > needs to carry out layout calculations before it can know the available
27 > space.
28 >
29 > --[[smcv]]