|
Post by MonsterControl on Feb 15, 2012 3:02:19 GMT -4
<script type="text/javascript"> var picWidth = '650'; //Maximum image width.. var picHeight = '650'; //Maximum image height..
var pics = document.images; if(window.addEventListener) { window.addEventListener('load', imageSize, false); } else if(window.attachEvent) { window.attachEvent('onload', imageSize); } else { window.onload = imageSize; }
function imageSize() { var p=pics.length-1; while(p>-1) { if(pics[p].alt=='[image] ') { if(pics[p].width>picWidth || pics[p].height>picHeight) { var thisPicWidth = picWidth; if(pics[p].height/(pics[p].width/picWidth)>picHeight) { thisPicWidth = pics[p].width/(pics[p].height/picHeight) } var newWidth = 100-parseInt(thisPicWidth/pics[p].width*100); var picLoaded = document.createElement('A'); picLoaded.setAttribute('href',pics[p].src); picLoaded.setAttribute('target','_blank'); picLoaded.innerHTML = '<font size="0">This image is reduced by '+newWidth+'%, click it to view full size.</font><br><img src="'+pics[p].src+'" width="'+thisPicWidth+'" border="0">'; pics[p].parentNode.replaceChild(picLoaded,pics[p]); }} p--; }} </script>
|
|