UBB.Dev
Posted By: Painfool Automatically limit inline images to 640 wide - 05/21/2006 11:55 PM
With more and more people jumping on the Digital Camera bandwagon... and 6 megapixel cameras cranking out 2100 pixel plus pictures, is there an easy way to automatically display images larger than 640pixels as a 640 thumbnail that links to the image?

I saw the Thumbnail Mod, but it didnt work for me, got some $Returner errors ... but even if it did work.. that would mean educating people on when to use the THUMB code. I'd prefer if it just did it for them smile

Thanks for your consideration!
Posted By: Gizmo Re: Automatically limit inline images to 640 wide - 05/22/2006 12:05 AM
Could be slightly dangerous; if you edited the image code, any image SMALLER than 640 would be enlarged... Immagine that 20px smily displaying as 640x480 lol...
Yeah, I had considered that already smile So Im hoping Ian has something up his sleeve hehe
ugh, it'd require javascript since IE hates max-width

something like

Code
function fix_images( max_width ) {
var images = document.getElementsByTagName( "img" );
var i = 0;
for( i = 0; i < images.length; i++ ) {
var img = images[i];
if( img.width > max_width && img.alt == "-" ) {
var new_height = img.height * ( max_width / img.width );
img.width = max_width;
}
}
}
© UBB.Developers