提交 106c5bb3 编写于 作者: Q qiang

feat(app): chooseImage crop

上级 907895a5
...@@ -49,7 +49,8 @@ function compressImage (tempFilePath) { ...@@ -49,7 +49,8 @@ function compressImage (tempFilePath) {
export function chooseImage ({ export function chooseImage ({
count, count,
sizeType, sizeType,
sourceType sourceType,
crop
} = {}, callbackId) { } = {}, callbackId) {
const errorCallback = warpPlusErrorCallback(callbackId, 'chooseImage', 'cancel') const errorCallback = warpPlusErrorCallback(callbackId, 'chooseImage', 'cancel')
...@@ -65,7 +66,7 @@ export function chooseImage ({ ...@@ -65,7 +66,7 @@ export function chooseImage ({
// 压缩阈值 0.5 兆 // 压缩阈值 0.5 兆
const THRESHOLD = 1024 * 1024 * 0.5 const THRESHOLD = 1024 * 1024 * 0.5
// 判断是否需要压缩 // 判断是否需要压缩
if (sizeType.includes('compressed') && size > THRESHOLD) { if (!crop && sizeType.includes('compressed') && size > THRESHOLD) {
return compressImage(path).then(dstPath => { return compressImage(path).then(dstPath => {
path = dstPath path = dstPath
return getFileInfo(path) return getFileInfo(path)
...@@ -93,7 +94,8 @@ export function chooseImage ({ ...@@ -93,7 +94,8 @@ export function chooseImage ({
camera.captureImage(path => successCallback([path]), camera.captureImage(path => successCallback([path]),
errorCallback, { errorCallback, {
filename: TEMP_PATH + '/camera/', filename: TEMP_PATH + '/camera/',
resolution: 'high' resolution: 'high',
crop
}) })
} }
...@@ -103,7 +105,8 @@ export function chooseImage ({ ...@@ -103,7 +105,8 @@ export function chooseImage ({
multiple: true, multiple: true,
system: false, system: false,
filename: TEMP_PATH + '/gallery/', filename: TEMP_PATH + '/gallery/',
permissionAlert: true permissionAlert: true,
crop
}) })
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册