百度编辑器图片在线流量返回url改动

百度编辑器中返回的是我们server中的url,有时并非我们须要的,比方图文编辑中。我想在线浏览上传过的图片 ,那么我返回的应该是腾讯server上面的url。这样才不会被腾讯的过滤器过来掉,全部我们就须要改动在线管理的图片获取路径详细操作例如以下:

BaseState fileState = null;

File file = null;
String realpath= null;
for ( Object obj : files ) {
if ( obj == null ) {
break;
}
file = (File)obj;
fileState = new BaseState( true );
realpath=  PathFormat.format( this.getPath( file ) );
//fileState.putInfo( "url", PathFormat.format( this.getPath( file ) ) );
//TODO  处理列出的图片信息
String url=UploadToTX.urlSelect(realpath);
fileState.putInfo( "url", url);

state.addState( fileState );
}

return state;



改动后的在线浏览还是浏览不出来,还须要改动对话框中的js文件。改动/ueditor/dialogs/image/image.js以下的js就能够了。不然会显示图片引用未授权。

                    //TODO
                    //img.setAttribute('src', urlPrefix + list[i].url + (list[i].url.indexOf('?') == -1 ? '?noCache=':'&noCache=') + (+new Date()).toString(36) );
                    img.setAttribute('src', urlPrefix + list[i].url );



原文地址:https://www.cnblogs.com/jzssuanfa/p/7110862.html