I did it thanks to TECK.
vbulletin_global.js:
Code:
/**
* Function to resize an image used with the [IMG] bbcode tag
*
* @param string Image object
* @param string Image link
* @param integer Image max width
*/
function resize_image(obj, link, maxwidth)
{
if (obj.width > maxwidth)
{
obj.style.cursor = 'pointer';
obj.style.width = maxwidth + 'px';
obj.style.height = parseInt(obj.height * maxwidth / obj.width) + 'px';
obj.onclick = function()
{
window.location.href = link;
return false;
};
}
}
/**
* Function to emulate document.getElementById
CSS:
HTML Code:
.resize {
max-width: 728px; width: expression(this.width > 728 ? 728: true);
}
class_bbcode.php:
PHP Code:
return '<img class="resize" src="' . $link . '" border="0" alt="" onload="resize_image(this, \'' . $link . '\', 727);" />';
But unfortunately automatic linking to the original dimensions only work for IE and Opera. I at least need it for Firefox, too.
Test page:
http://www.msxlabs.org/forum/fantazi...r-2-a-202.html