百度ueditor上傳圖片時設定預設寬高度

來源:互聯網
上載者:User
 我也是逼了dog了,百度編輯器官方文檔其實做的很不詳細,都是些基本的用法,想設定個上傳圖片預設尺寸都找不到相應文檔。進過哥的不屑努力,終於是配置好了,其實也是很簡單的,加了一行代碼。。。。。 

找到編輯器根目錄下面的ueditor.all.js ,一開啟嚇到哥了,上萬行代碼,不過不要怕,search 一下 :cllback() 找到這個函數

 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('title', json.title || '');                            loader.setAttribute('alt', json.original || '');                            loader.setAttribute('style','max-width:650px');//這裡就是哥加入的代碼                            loader.removeAttribute('id');                            domUtils.removeClasses(loader, 'loadingclass');                        }

看看注釋部分,其實就是給img 上傳的圖片價格屬性就行了! 你可以任意增加屬性,就這麼任性,就是這麼隨意,走過路過,學到了的就給哥贊一個!!

以上就介紹了百度ueditor上傳圖片時設定預設寬高度,包括了方面的內容,希望對PHP教程有興趣的朋友有所協助。

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.