国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計(jì) > 正文

百度ueditor 上傳圖片后如何設(shè)置樣式

2019-11-15 01:57:08
字體:
供稿:網(wǎng)友
百度ueditor 上傳圖片后如何設(shè)置樣式

最近項(xiàng)目中遇到一個(gè)問題,UEditor上傳圖片后,在內(nèi)容展示會修改圖片樣式。但是表情也是img標(biāo)簽,所以全局修改是有問題的,

所以只能著手修改一下插件的代碼。

首先找到圖片上傳的服務(wù)器段文件。這里主要是php講解

找到php目錄下Uploader.class.php 337行

public function getFileInfo()   {       return array(           "state" => $this->stateInfo,           "url" => $this->fullName,           "title" => $this->fileName,           "original" => $this->oriName,           "type" => $this->fileType,   "class"=> "aaa"           "size" => $this->fileSize,       );   }

這樣返回的json 多一個(gè)class 屬性的值

一種是修改js

找到ueditor.all.js 中 24461 如下代碼

修改js

function callback(){try{var link, json, loader,body = (iframe.contentDocument || iframe.contentWindow.document).body,result = body.innerText || body.textContent || '';json = (new Function("return " + result))();link = me.options.imageUrlPRefix + json.url;if(json.state == 'SUCCESS' && json.url) {loader = me.document.getElementById(loadingId);loader.setAttribute('src', link);loader.setAttribute('_src', link);loader.setAttribute('class', json.class || ''); //添加行代碼loader.setAttribute('title', json.title || '');loader.setAttribute('alt', json.original || '');loader.removeAttribute('id');domUtils.removeClasses(loader, 'loadingclass');} else {showErrorLoader && showErrorLoader(json.state);}}catch(er){showErrorLoader && showErrorLoader(me.getLang('simpleupload.loadError'));}form.reset();domUtils.un(iframe, 'load', callback);}

這樣上傳下圖片你就能看見上傳的圖片都多了個(gè)樣式。


發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 临武县| 阳城县| 泸州市| 栖霞市| 柳江县| 林芝县| 嵩明县| 钟祥市| 申扎县| 基隆市| 龙州县| 洪泽县| 新闻| 肃南| 观塘区| 大洼县| 乐陵市| 瓮安县| 铜陵市| 永宁县| 阿克苏市| 修文县| 贺州市| 仁化县| 唐山市| 呈贡县| 海丰县| 邻水| 秦皇岛市| 安顺市| 竹山县| 渝中区| 湟源县| 德兴市| 河津市| 井冈山市| 新巴尔虎左旗| 舒兰市| 通江县| 永胜县| 昌吉市|