提交 b44d3b45 编写于 作者: Q qiang

feat(App): uni.compressImage 支持其他配置

上级 8be3013d
......@@ -6,23 +6,20 @@ import {
invoke
} from '../../bridge'
export function compressImage ({
src,
quality
}, callbackId) {
var dst = TEMP_PATH + '/compressed/' + Date.now() + (src.match(/\.\S+$/) || [''])[0]
plus.zip.compressImage({
src,
dst,
quality
}, () => {
import {
warpPlusErrorCallback,
getFileName
} from '../util'
export function compressImage (options, callbackId) {
const dst = `${TEMP_PATH}/compressed/${Date.now()}_${getFileName(options.src)}`
const errorCallback = warpPlusErrorCallback(callbackId, 'compressImage')
plus.zip.compressImage(Object.assign({}, options, {
dst
}), () => {
invoke(callbackId, {
errMsg: 'compressImage:ok',
tempFilePath: dst
})
}, () => {
invoke(callbackId, {
errMsg: 'compressImage:fail'
})
})
}, errorCallback)
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册