调整图片大小

This commit is contained in:
java110 2020-05-22 10:54:55 +08:00
parent f8f1f0a07e
commit 67f8242e84

View File

@ -165,7 +165,10 @@
if (vc.component._editUserMedia()) {
vc.component.editOwnerInfo.videoPlaying = false;
var constraints = {
video: true,
video: {
width:208,
height:208
},
audio: false
};
var video = document.getElementById('ownerPhotoForEdit');
@ -191,9 +194,9 @@
if (vc.component.editOwnerInfo.videoPlaying) {
var canvas = document.getElementById('canvasForEdit');
var video = document.getElementById('ownerPhotoForEdit');
canvas.width = video.videoWidth;
canvas.height = video.videoHeight;
canvas.getContext('2d').drawImage(video, 0, 0);
canvas.width = 208;
canvas.height = 208;
canvas.getContext('2d').drawImage(video, 0,0);
var data = canvas.toDataURL('image/jpeg',1.0);
vc.component.editOwnerInfo.ownerPhoto = data;
//document.getElementById('photo').setAttribute('src', data);