Picture Resize

xiaoxiao2021-03-31  204

/ / 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

转载请注明原文地址:https://www.9cbs.com/read-130890.html

New Post(0)