Conforums Support
Board Enhancements >> Hacks >> Reduce size of images in posts
http://support.conforums.com/index.cgi?board=code&action=display&num=1155977969

Reduce size of images in posts
Post by Garet on Aug 19th, 2006, 03:59am

Ok, this code will reduce the size of images in posts that are over a specified height and width.

Code submitted by: Zando

Place this code in your Board Footers

It is Cross-Browser in FF & IE

Edit the colors

Read below code for more instructions.


<script type="text/javascript">
<!--

/* ~~~~~~~~~~~~~~~~~~ *\
Reduce size of Images In Posts.
\* ~~~~~~~~~~~~~~~~~~ */

var wid="1280"; //Maximum Width
var hei="768"; //Maximum Heigth
var red="2"; //Number the size of the image will be divided by

var tdz=document.getElementsByTagName("td")
for(a=0;a<tdz.length;a++){
if(tdz[a].className.match(/windowbg2|windowbg/) && tdz[a].vAlign=="top" && tdz[a].width=="80%"){
var pic=tdz[a].getElementsByTagName("img")
for(z=0;z<pic.length;z++){
if(pic[z].width>=wid && pic[z].height>=hei){
var url=pic[z].src
var hi=pic[z].height;var wi=pic[z].width;
var hi2=hi/red;var wi2=wi/red;
pic[z].height=hi2;pic[z].width=wi2
}
}
}
}

//-->
</script>


Only secition of the code that needs editing is this part.
var wid="1280"; //Maximum Width
var hei="768"; //Maximum Heigth
var red="2"; //Number the size of the image will be divided by


Anything above or equal to 1280 in width and anything above or equal to 768 in height will have it size divided by 2