code: function detectVerticalSquash(img) {
      // 拍照在IOS7或以下的机型会出现照片被压扁的bug
      var data;
      var ih = img.naturalHeight;
      var canvas = document.createElement('canvas');
      canvas.width = 1;
      canvas.height = ih;
      var ctx = canvas.getContext('2d');
      ctx.drawImage(img, 0, 0);
      try {
          data = ctx.getImageData(0, 0, 1, ih).data;
      } catch (err) {
          console.log('Cannot check verticalSquash: CORS?');
          return 1;
      }
      var sy = 0;
      var ey = ih;
      var py = ih;
      while (py > sy) {
          var alpha = data[(py - 1) * 4 + 3];
          if (alpha === 0) {
              ey = py;
          } else {
              sy = py;
          }
          py = (ey + sy) >> 1; // py = parseInt((ey + sy) / 2)
      }
      var ratio = (py / ih);
      return (ratio === 0) ? 1 : ratio;
  }
docs: /*
  Tencent is pleased to support the open source community by making WeUI.js available.
  
  Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
  
  Licensed under the MIT License (the "License"); you may not use this file except in compliance
  with the License. You may obtain a copy of the License at
  
  http://opensource.org/licenses/MIT
  
  Unless required by applicable law or agreed to in writing, software distributed under the License is
  distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
  either express or implied. See the License for the specific language governing permissions and
  limitations under the License.
   
  检查图片是否有被压扁，如果有，返回比率
  ref to http://stackoverflow.com/questions/11929099/html5-canvas-drawimage-ratio-bug-ios