提交 b44d3b45 编写于 作者: Q qiang

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

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