//对img添加额外数据
if (node.tag === 'img') {
node.full_path = node.attr.src;
node.imgIndex = results.images.length;
var imgUrl = node.attr.src;
// jpg正则
var reg = /[http|https]:\/\/.*?(jpg)/gi;
imgUrl = wxDiscode.urlToHttpUrl(imgUrl, __placeImgeUrlHttps);
// 正则匹配图片地址
if (reg.test(imgUrl)) {
//不包含其他url参数
if (imgUrl.indexOf('?') == -1 ){
imgUrl += '?x-oss-process=image/resize,m_lfit,w_500';
}else{
imgUrl += '&x-oss-process=image/resize,m_lfit,w_500';
}
}
if ( isAndroid ){
if (imgUrl.indexOf('x-oss-process=image/resize') != -1) {
imgUrl += '/format,webp';
} else {
imgUrl += '?x-oss-process=image/format,webp';
}
}
node.attr.src = imgUrl;
node.from = bindName;
results.images.push(node);
results.imageUrls.push(imgUrl);
}