With html I can scale an image's width to a percentage of the available window like this:
<img src=whatever.png width=50% />
With mediawiki this seems to be impossible (if you do not allow html injections). Is it really? Don't tell me I have to write a mediawiki extension ;)
Note the CSS answer from Is there a way automatically to resize MediaWiki images depending on screen size? is not a solution. I want to have different images in one page with different percentages.
It should be possible to apply the CSS solution to specific images by tagging them with a custom class name. That is, you'd add something like the following to your MediaWiki:Common.css page:
img.halfwidth {
width: 50%;
height: auto;
}
and then use wiki markup like this:
[[File:Myimage.jpg|class=halfwidth]]
(Note that specifying a class name on an image like this requires MediaWiki 1.20+. If, for some reason, you need to do this on an older MediaWiki version, you can instead change the CSS selector to e.g. .halfwidth img
, and the wiki syntax to <div class="halfwidth">[[File:Myimage.png]]</div>
.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With