0

我的照片方向有问题,当从某些移动设备上传照片时,照片上传的方向错误,当我调整大小时出现问题

我正在使用:dropezone vue(链接)+ exif js(链接

我尝试安装 exif js 包来修复方向

<vue-dropzone class="mb-4 bg-sh "  style="border: 2px dotted #037ef3;padding:0px;"   @vdropzone-upload-progress="dropzoneUploadProgress"   @vdropzone-file-added="dropzoneFileAdded"  v-on:vdropzone-success="uploadSuccess"     @vdropzone-sending-multiple="sendMessage" ref="myVueDropzone"    v-on:vdropzone-error="failed"  @vdropzone-total-upload-progress="get_progress"    @vdropzone-complete="afterUploadComplete"
 id="dropzone" :useCustomSlot=true :options="dropzoneOptions">

我将 exif 添加到 app.js :

import EXIF from 'exif-js/exif';

window.EXIF=EXIF

我尝试在 dropzoneFileAdded 函数中应用:

      dropzoneFileAdded(file){   
            var orientation = 0;
EXIF.getData(file, function() {
    switch(parseInt(EXIF.getTag(this,"Orientation"))){
        case 3: orientation = 180; break;
        case 6: orientation = -90; break;
        case 8: orientation = 90; break; 
    }
});
    this.dropzoneTotalFilesize += file.size;
  }

但保持同样的问题

4

0 回答 0