code: function (img, w, h) {
              var ow = img.width,
                  oh = img.height;
  
              if (ow >= oh) {
                  img.width = w * ow / oh;
                  img.height = h;
                  img.style.marginLeft = '-' + parseInt((img.width - w) / 2) + 'px';
              } else {
                  img.width = w;
                  img.height = h * oh / ow;
                  img.style.marginTop = '-' + parseInt((img.height - h) / 2) + 'px';
              }
          }
docs: /* 改变图片大小