Revert "fix:用takePhoto全分辨率+plus.zip裁剪缩放1080×1080,清晰度提升"
This reverts commit 8cc78be15d.
This commit is contained in:
parent
8cc78be15d
commit
b2002f3d92
@ -130,7 +130,7 @@
|
|||||||
uni.showToast({ title: '相机未就绪', icon: 'none' })
|
uni.showToast({ title: '相机未就绪', icon: 'none' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.$refs.cameraRef.takePhoto()
|
this.$refs.cameraRef.takePhotoSnapshot()
|
||||||
},
|
},
|
||||||
onPictureTaken(e) {
|
onPictureTaken(e) {
|
||||||
var path = ''
|
var path = ''
|
||||||
@ -138,46 +138,9 @@
|
|||||||
path = e.detail.path || ''
|
path = e.detail.path || ''
|
||||||
}
|
}
|
||||||
if (path) {
|
if (path) {
|
||||||
this.resizeTo1080(path)
|
this.capturedList.push(path)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 居中裁剪为 1080×1080
|
|
||||||
resizeTo1080(srcPath) {
|
|
||||||
var that = this
|
|
||||||
uni.getImageInfo({
|
|
||||||
src: srcPath,
|
|
||||||
success: function(info) {
|
|
||||||
var w = info.width
|
|
||||||
var h = info.height
|
|
||||||
var size = Math.min(w, h)
|
|
||||||
var clipX = Math.floor((w - size) / 2)
|
|
||||||
var clipY = Math.floor((h - size) / 2)
|
|
||||||
plus.zip.compressImage({
|
|
||||||
src: srcPath,
|
|
||||||
dst: '_doc/sq_' + Date.now() + '.jpg',
|
|
||||||
width: '1080',
|
|
||||||
height: '1080',
|
|
||||||
quality: 95,
|
|
||||||
overwrite: true,
|
|
||||||
clip: {
|
|
||||||
x: clipX,
|
|
||||||
y: clipY,
|
|
||||||
width: size,
|
|
||||||
height: size
|
|
||||||
}
|
|
||||||
},
|
|
||||||
function(res) {
|
|
||||||
that.capturedList.push(res.target)
|
|
||||||
},
|
|
||||||
function() {
|
|
||||||
that.capturedList.push(srcPath)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
fail: function() {
|
|
||||||
that.capturedList.push(srcPath)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
flipCamera() {
|
flipCamera() {
|
||||||
this.facing = this.facing === 'back' ? 'front' : 'back'
|
this.facing = this.facing === 'back' ? 'front' : 'back'
|
||||||
this.$refs.cameraRef.changeFacing(this.facing)
|
this.$refs.cameraRef.changeFacing(this.facing)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user