Post by Death to ALL on Sept 3, 2005 14:17:16 GMT -8
NOTE: This Code has just been updated
will place scroll bars on images over the set size.
place code in global footer.
I did some testing now with FireFox and have edited the code to work with FireFox and IE
Thanks too California on the help
will place scroll bars on images over the set size.
place code in global footer.
I did some testing now with FireFox and have edited the code to work with FireFox and IE
<script type="text/javascript">
<!--
/* set max posted image size with scrollbars for larger by Death to ALL
edit the maxWidth and maxHeight for the max size of images posted,
will also be the size of the iframe for larger images.
*/
var maxWidth=750;
var maxHeight=750;
var img=document.getElementsByTagName("img");
for(s=0;s<img.length;s++)
{
if (img[s].alt.match(/\[image\]/i))
{
img[s].onload = function()
{
if (this.width>maxWidth || this.height>maxHeight)
{
var iFrame = document.createElement("iframe");
iFrame.src = this.src;
var iFrameWidth = maxWidth;
if (this.width<maxWidth)
{
iFrameWidth = this.width;
}
iFrame.width = iFrameWidth;
var iFrameHeight = maxHeight;
if (this.height<maxHeight)
{
iFrameHeight = this.height;
}
iFrame.height = iFrameHeight;
iFrame.frameBorder = "0";
iFrame.noResize = "true";
iFrame.scrolling = "auto";
iFrame.style.display = "block";
iFrame.marginHeight = "0";
iFrame.marginWidth = "0";
this.parentNode.replaceChild(iFrame, this);
}
}
}
if((img[s].width>maxWidth || img[s].height>maxHeight) && img[s].alt.match(/\[image\]/i))
{
var iFrame = document.createElement("iframe");
iFrame.src = img[s].src;
var iFrameWidth = maxWidth;
if (this.width<maxWidth)
{
iFrameWidth = this.width;
}
iFrame.width = iFrameWidth;
var iFrameHeight = maxHeight;
if (this.height<maxHeight)
{
iFrameHeight = this.height;
}
iFrame.height = iFrameHeight;
iFrame.frameBorder = "0";
iFrame.noResize = "true";
iFrame.scrolling = "auto";
iFrame.style.display = "block";
iFrame.marginHeight = "0";
iFrame.marginWidth = "0";
img[s].parentNode.replaceChild(iFrame,img[s]);
}
}
// -->
</script>
Thanks too California on the help