Short description

On some themes I only use a logo banner image for the title/logo. This should also be resized by the browser width.

Currently I solve this by an extension of the common.js by

function resize_image(which, max) {
    var elem = document.getElementById(which);
    if (elem == undefined || elem == null) return false;
    if (max == undefined) max = document.body.clientWidth; 
    if (elem.width > elem.height) {
        if (elem.width > max) elem.style.width = max + 'px';
     } else {
        if (elem.height > max) elem.style.height = max + 'px';
     }
}

this solution is based on http://atomgiant.com/2006/05/30/resize-images-with-javascript/

and an image definition, e.g.

<img id="logo_image" onload="resize_image('logo_image')" src="/moin_static183/banner.png" alt="banner">

(!) if we can get the browser width on each request we maybe can use the Image class to shrink the size and to cache the new sized banner.

I do not like this feature for a default moinmoin theme very much, reasons:

I personally do not like to use javascripts to tweak some layout stuff; images with css (% for width and use max-/min-width or just using background images is maybe the cleaner solution). well just IMHO bye -- MarcelHäfner 2009-04-30 17:10:13

Note about embedded files:


CategoryFeatureRequest

MoinMoin: FeatureRequests/resize_images_by_js (last edited 2009-06-18 23:11:33 by ReimarBauer)