tags:

views:

292

answers:

2

MediaWiki has a great built-in way for finessing the display of images, e.g. from http://www.mediawiki.org/wiki/Help%3AImages :

[[File:MediaWiki:Image sample|thumb|50px]]
[[File:MediaWiki:Image sample|border|50px]]

However, unfortunately, the MediaWiki repository I have to work with has disabled image uploads.

I'm wondering if there's a way I can apply the above convenience shortcuts to an externally hosted image URL, e.g. ideal would be:

 [[File:http://somewhere.com/image.jpg|thumb|50px]]

Is what I'm trying to do impossible?

+2  A: 

Yes, can't be done. From http://www.mediawiki.org/wiki/Manual:$wgAllowExternalImages#Thumbnails_of_external_images :

For resizing images in mediawiki they need to have a row in image table of database containing dimensions and other information of image so you can't resize external images.

If those images have been uploaded in another mediawiki or if they are somewhere in your site and you want to let mediawiki make thumbnail of them you can set $wgUseSharedUploads to true and set $wgSharedUploadPath and $wgSharedUploadDBname instead of enabling external images.

Aaron F.
A: 

If client-side resizing is sufficient, you could probably whip something up with CSS...

Wrap the image you want to resize in a div or span and give it a particular class like:

<div class="image100px">http://example.com/path/to/image.jpeg&lt;/div>

And in the [[MediaWiki:Common.css]] page on the wiki add an entry like this:

.image100px img { width: 100px; }

(Note that due to caching of the CSS you might have to force a reload to see the update.)

If you need to serve out server-resized images, then the easiest way will be to just resize the images and upload them on your external server. (Alternatively you could write a MediaWiki extension that will rescale external images, but if you can't even turn on uploads this won't help you much!)

Brion