/ / Picture Control Function, MyImg parameter is always this, MaxWidth is the maximum value value, and maxHEight is the maximum height value;
Function Resize (MyIMG, Maxwidth, Maxheight)
{
VAR inipicwidth = myimg.width;
Var inipicheight = myimg.height;
Var inirate = inipicheight / inipicwidth;
IF (InipicWidth> MaxWidth || inipicheight> maxheight) {
Var neww = maxwidth;
VAR new = math.floor (neww * inirate);
IF (newH> maxheight)
{
VAR new = maxheight;
Var neww = math.floor (new / inirate);
}
MyImg.width = newwww;
MyImg.height = new;
}
}
Instructions