Post by SubDevo on Feb 27, 2010 15:08:02 GMT -8
Image Size Limits by SubDevo
Tested in IE, FF, Opera, Safari and Chrome.
This code allows you to limit the size of images posted so they do not stretch your forum.
Images larger than your required size will be resized.
Variables:
var pWidth=500; // Max Image Width (px).
var pHeight=1000; // Max Image Height (px).
Just what they say. Enter the maximum allowable height and width of images here.
var pTitle="Click Image To View Full Size."; // Image Link/Title Text.
This text is will be shown when you mouseover the image.
var showLink=1; // Show link Text? 1=Yes, 0=No
If this is set to "1", the code will put a text link above the image with the text you put in for the previous variable "pTitle".
Enjoy!!!
SubDevo
Location: Global Footer
<script type="text/javascript">
/* Image Size Limits by SubDevo */
/* Global Footer - Please leave this header intact. Do not repost. */
/* interoceandesigns.com or lsdp.proboards.com */
var pWidth=500; // Max Image Width (px).
var pHeight=1000; // Max Image Height (px).
var pTitle="Click Image To View Full Size."; // Image Link/Title Text.
var showLink=1; // Show link Text? 1=Yes, 0=No
function iSize(){ var n=document.images,ph,pw,a,p,_x=-1;
var nT=(showLink)?"<font size='2'>"+pTitle+"</font><br />":"";
while(n[++_x]){a=n[_x]; ph=a.height/pHeight; pw=a.width/pWidth;
if(a.alt=="[image] "&&(pw>1||ph>1)){
p=document.createElement("a"); p.href=a.src; p.target="_blank"; p.title=pTitle;
p.innerHTML=nT+"<img src='"+a.src+"' width='"+((ph>pw)?a.width/ph:pWidth)+"' border='0'>";
n[_x].parentNode.replaceChild(p,n[_x]);
}}}
(window.attachEvent)?window.attachEvent("onload",iSize):window.addEventListener("load",iSize,false);
</script>
Tested in IE, FF, Opera, Safari and Chrome.
This code allows you to limit the size of images posted so they do not stretch your forum.
Images larger than your required size will be resized.
Variables:
var pWidth=500; // Max Image Width (px).
var pHeight=1000; // Max Image Height (px).
Just what they say. Enter the maximum allowable height and width of images here.
var pTitle="Click Image To View Full Size."; // Image Link/Title Text.
This text is will be shown when you mouseover the image.
var showLink=1; // Show link Text? 1=Yes, 0=No
If this is set to "1", the code will put a text link above the image with the text you put in for the previous variable "pTitle".
Enjoy!!!
SubDevo
Location: Global Footer
<script type="text/javascript">
/* Image Size Limits by SubDevo */
/* Global Footer - Please leave this header intact. Do not repost. */
/* interoceandesigns.com or lsdp.proboards.com */
var pWidth=500; // Max Image Width (px).
var pHeight=1000; // Max Image Height (px).
var pTitle="Click Image To View Full Size."; // Image Link/Title Text.
var showLink=1; // Show link Text? 1=Yes, 0=No
function iSize(){ var n=document.images,ph,pw,a,p,_x=-1;
var nT=(showLink)?"<font size='2'>"+pTitle+"</font><br />":"";
while(n[++_x]){a=n[_x]; ph=a.height/pHeight; pw=a.width/pWidth;
if(a.alt=="[image] "&&(pw>1||ph>1)){
p=document.createElement("a"); p.href=a.src; p.target="_blank"; p.title=pTitle;
p.innerHTML=nT+"<img src='"+a.src+"' width='"+((ph>pw)?a.width/ph:pWidth)+"' border='0'>";
n[_x].parentNode.replaceChild(p,n[_x]);
}}}
(window.attachEvent)?window.attachEvent("onload",iSize):window.addEventListener("load",iSize,false);
</script>