inherit
24252
0
Aug 1, 2023 15:01:24 GMT -8
coolcoolcool
When the world says, "Give up," Hope whispers, "Try it one more time."
2,148
May 2004
coolcoolcool
|
Post by coolcoolcool on Jul 25, 2006 18:31:41 GMT -8
Crossbrowser: yes Location: Global Footers
Meh, I think this would be usefull.
<script type="text/javascript"> <!-- /*Convert oversized images to links, Created By coolcoolcool*/ // Max Size of Posted Image var yourwidth = 500; // Text to be displayed for the link in place of the image var linktext = "This is the link"; var td = document.getElementsByTagName("td"); for(var loop = 0;loop<td.length;loop++){ if(td[loop].colSpan=="3" && td[loop].firstChild.nodeName.match(/hr/i) && td[loop].vAlign=="top"){ for(var t=0;t<td[loop].childNodes[1].childNodes.length;t++){ if(td[loop].childNodes[1].childNodes[t].nodeName.match(/img/i)){ var width = td[loop].childNodes[1].childNodes[t].width; if(width>yourwidth){ var news = document.createElement("a"); news.href = td[loop].childNodes[1].childNodes[t].src; news.innerHTML = linktext; td[loop].childNodes[1].replaceChild(news,td[loop].childNodes[1].childNodes[t]); }}}}} //--> </script>
How to edit:
// Max Size of Posted Image var yourwidth = 500; // Text to be displayed for the link in place of the image var linktext = "This is the link";
Change var yourwidth = 500; to the largest image width you want posted. So, if you wanted the largest width to be 650, simple put...
var yourwidth = 650;
Now the part that says var linktext = "This is the link";, is what the name of the link would be. So, if you want the link to read, Image Converted to Link do to Size, simple put...
var linktext = "Image Converted to Link do to Size";
Have fun.
|
|