Post by ⓦ৹₪deⓡ on Oct 19, 2005 18:55:41 GMT -8
This code will scale large images down in posts and signatures. You can have different max sizes for each. Edit where indicated. Enjoy.
~Wonder
Global Footer
June 3, 2009: v45 Update ~ Triad
~Wonder
Global Footer
<script>
//Scale Large Images in Posts and Signatures v1.0
//Copyright 10-19-2005 ~Wonder
//May be reposted anywhere as long as this header remains in tact
//Enter Max Height/Width of images
maxPostHeight=200;
maxPostWidth=200;
maxSigHeight=200;
maxSigWidth=200;
if(location.href.match(/action=(display|goto|viewprofile|pmview|recent)/))
{
td = document.getElementsByTagName("td");
server=location.href.split(".com")[0];
for(i = 0; i < td.length; i ++)
{
if(td[i].innerHTML.match(/(Reply #\d)|(Thread Started)/) && td[i].getElementsByTagName("img").length==0)
{
temp=td[i].parentNode.nextSibling.getElementsByTagName("img");
for(j=0;j<temp.length;j++)
{
temp[j].onload=resizePostImage;
}
}
if (td[i].className.match("windowbg") && td[i].align=="left" && td[i].vAlign=="bottom" && td[i].lastChild.nodeName=="FONT")
{
temp=td[i].lastChild.getElementsByTagName("img");
for(j=0;j<temp.length;j++)
{
temp[j].onload=resizeSigImage;
}
}
}
}
function resizePostImage()
{
if(this.height>maxPostHeight){this.width=Math.round((maxPostHeight/this.height)*this.width);this.height=maxPostHeight ;}
if(this.width>maxPostWidth){this.height=Math.round((maxPostWidth/this.width)*this.height);this.width=maxPostWidth;}
}
function resizeSigImage()
{
if(this.height>maxSigHeight){this.width=Math.round((maxSigHeight/this.height)*this.width);this.height=maxSigHeight;}
if(this.width>maxSigWidth){this.height=Math.round((maxSigWidth/this.width)*this.height);this.width=maxSigWidth;}
}
</script>
~modified Dec 8th, 2005 at 1:56pmJune 3, 2009: v45 Update ~ Triad