Difference between revisions of "External Image"

From PKC
Jump to navigation Jump to search
 
Line 1: Line 1:
To reference an external image and make sure it appears with a controllable parameter, one can reference this page on Stack overflow<ref>https://stackoverflow.com/questions/19450262/mediawiki-set-external-image-width-by-value</ref>:
 
To reference an external image and make sure it appears with a controllable parameter, one can reference this page on Stack overflow<ref>https://stackoverflow.com/questions/19450262/mediawiki-set-external-image-width-by-value</ref>.


The original post by stack overflow user [https://stackoverflow.com/users/82439/brion Brion] is reproduced and the template has been created here:
The original post by stack overflow user [https://stackoverflow.com/users/82439/brion Brion] is reproduced and the template has been created here:
The first step is to add one more line in <code>LocalSettings.php</code>.
<syntaxhighlight lang=PHP>
$wgAllowExternalImages = true;
</syntaxhighlight>
Then, you need to have admin access to the MediaWiki site, so that you can edit the file:<code>MediaWiki:Common.css</code>.


In [[MediaWiki:Common.css]] add:
In [[MediaWiki:Common.css]] add:

Latest revision as of 18:28, 12 September 2021

To reference an external image and make sure it appears with a controllable parameter, one can reference this page on Stack overflow[1].

The original post by stack overflow user Brion is reproduced and the template has been created here:


The first step is to add one more line in LocalSettings.php.

$wgAllowExternalImages = true;

Then, you need to have admin access to the MediaWiki site, so that you can edit the file:MediaWiki:Common.css.

In MediaWiki:Common.css add:

.externalimage-holder {
    position: relative;
}
.externalimage-holder img {
    width: 100%;
    height: auto;
}

Then, set up a Template in Template:Sized-external-image like this:

<div class="externalimage-holder" style="width:{{{1}}}">{{{2}}}</div>

Then, call it like this:

{{sized-external-image|250px|https://storage.cloud.google.com/pub_papers/GitiFactory.png}}

Then, it should show up as follows:

References