智能照明系统APP-本地串口
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.
 
 
 
 
 
 
LightingSystemApp-serial/.svn/pristine/d2/d2f92a5d5c7ec28ee6567d2ed23...

27 lines
639 B

function _getServiceAddress () {
return window.location.protocol + '//' + window.location.host
}
export function getImageInfo ({
src
}, callbackId) {
const {
invokeCallbackHandler: invoke
} = UniServiceJSBridge
const img = new Image()
const realPath = src
img.onload = function () {
invoke(callbackId, {
errMsg: 'getImageInfo:ok',
width: img.naturalWidth,
height: img.naturalHeight,
path: realPath.indexOf('/') === 0 ? _getServiceAddress() + realPath : realPath
})
}
img.onerror = function (e) {
invoke(callbackId, {
errMsg: 'getImageInfo:fail'
})
}
img.src = src
}