Baidu Ueditor How to set style after uploading pictures

Source: Internet
Author: User
Tags php tutorial
Ueditor is developed by the Baidu Web front-end research and development department to see the Rich Text Web editor, with a lightweight, customizable, focus on user experience and other characteristics, open source based on the MIT protocol, allowing free use and modification of code, covering popular Rich text editor features, unique new editing operation mode.

below to see Ueditor upload pictures, in the content exhibition to modify the image style. But the expression is also an IMG tag, so the global modification is problematic,

So you can only start to modify the plugin code.

First find the image upload server segment file. Here is the main explanation of PHP

Find Uploader.class.php 337 lines in the PHP directory

Public Function GetFileInfo ()   {       return array (           "state" = = $this->stateinfo,           "url" = = $this- >fullname, "           title" and "$this->filename,           " "Original" and $this->oriname,           "type" and "= $this- >filetype,   "class" and "AAA", "           size" (= $this->filesize,       );   }

This returns the value of the JSON more than one class property

One is to modify JS

Find Ueditor.all.js in 24461 below code

Modify 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 | | ''); Add line Code loader.setattribute (' title ', Json.title | | "); Loader.setattribute (' Alt ', json.original | | | Loader.removeattribute (' id ');d omutils.removeclasses (loader, ' Loadingclass ');} else {showerrorloader && showerrorloader (json.state);}} catch (er) {showerrorloader && showerrorloader (Me.getlang (' simpleupload.loaderror '));} Form.reset ();d omutils.un (iframe, ' Load ', callback);}

This way, you can see that the uploaded images are more of a style.

The above describes how Baidu Ueditor upload pictures after how to set the style, including the content of Baidu Ueditor, I hope that the PHP tutorial interested friends have helped.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    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.