You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
486 B
28 lines
486 B
import {
|
|
TEMP_PATH
|
|
} from '../constants'
|
|
|
|
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
|
|
}, () => {
|
|
invoke(callbackId, {
|
|
errMsg: 'compressImage:ok',
|
|
tempFilePath: dst
|
|
})
|
|
}, () => {
|
|
invoke(callbackId, {
|
|
errMsg: 'compressImage:fail'
|
|
})
|
|
})
|
|
}
|
|
|