Iphone中的图像旋转问题(裁剪)

时间:2018-12-18 14:58:35

标签: javascript typescript croppie

我正在尝试上传图像,然后单击以旋转它,但是由于某些原因,此功能不适用于任何iPhone。

HTML

 <input type="file" id="avatar" name="avatar" accept="image/png, 
  image/jpeg" />
  <div id="vanilla" class="col-md-10 col-xs-12"></div>
  <div class="actions col-md-2 col-xs-12">
      <button class="vanilla-rotate rotate" (click)="rotate($event)" 
       data-deg="-90">Rotate Left</button>
      <button class="vanilla-rotate rotate" (click)="rotate($event)" 
       data-deg="90">Rotate Right</button>
      <button class="vanilla-result done 
       (click)="buttonClick()">Done</button>
  </div>
</div>`

JS

var inputFile = $('#avatar');
      console.log(that);
      inputFile.on('change', function(e: any){
            console.log(inputFile.val(), e, window.URL.createObjectURL(e.originalEvent.srcElement.files[0]));

          that.vanilla.bind({
              url: window.URL.createObjectURL(e.originalEvent.srcElement.files[0]),
              orientation: 1
          });
      })

 rotate(e: any) {
    console.log(e, $(e.path[0]).data());
    this.vanilla.rotate(parseInt($(e.path[0]).data('deg')));
  }

控制台错误

typeerror undefined is not an object (evaluating 't.path[0]')

0 个答案:

没有答案