thinkphp integrated Baidu Ueditor Graphic tutorial, _php tutorial

Source: Internet
Author: User

thinkphp integrated Baidu Ueditor graphic tutorial,


thinkphp integrated Baidu Ueditor, based on secondment Teacher's video description
Disclaimer: It is best to write absolute paths for absolute paths like: window. Ueditor_home_url

He has said in the tutorial, I will not say again Ah, just a pen, good no nonsense!

When invoking the editor, first initialize some values:

Then introduce 2 JS files, namely: 1, Ueditor.all.min.js 2, Ueditor.config.js
Here to affirm that I said the call way, the order absolutely can not mess, chaos will be a problem, so you follow my step-by-step to do it!

Because I rewrote the editor's image submission address, I still have to write a picture processing method in the controller.

The code is as follows:

Change ueditor default image upload path public    function Checkpic () {      import (' ORG.Net.UploadFile ');       $upload = new UploadFile ();//Instantiate upload class       $upload->allowexts = array (' jpg ', ' gif ', ' PNG ', ' jpeg ');//Set attachment upload type       $ Upload->autosub =true;       $upload->subtype = ' Date ';       $upload->dateformat = ' ym ';       $upload->savepath = './uploads/thumb/';//Set Attachment upload directory       if ($upload->upload ()) {         $info = $upload Getuploadfileinfo ();         echo json_encode (          ' url ' = + $info [0][' Savename '],          ' title ' =>htmlspecialchars ($_post[' Pictitle '], ent_quotes),          ' original ' = $info [0][' name '],          ' state ' = ' SUCCESS ')         ;       } else{         Echo json_encode (Array (         ' state ' = ' $upload->geterrormsg ())           }       }

I'll first show you the code first, in the continuation of the description,

1, the introduction of TP official File Upload processing class, and then initialize some configuration, these are not introduced AH!

2, judge whether he uploaded successfully, if the upload succeeded, first get his upload success information, and then turn the array into JSON, with Phpjson_encode. If the upload failed, the upload failed to return the information directly!

The above is in the Secondment teacher tutorial inside already explained! It is not explained in detail, do not know to see the video!

After the integration of the upload, found that the uploaded image path is escaped, has not been shown

I'm just going to show you where the data is. Use the inverse function to manipulate {$article. Content|stripslashes} This is to invert the escaped string so that the data can be displayed correctly.

Then, when the foreground template displays the data, it is not only to invert the semantics but also to remove the HTML entity, {$article. Content|htmlspecialchars_decode|stripslashes} This will be displayed properly!

There is a question, Baidu editor when the contents of the growth, his height is also growing,


The solution is in the Ueditor configuration file Ueditor.config.js, the inside of the No. 428 line to open the comment, changed to true, there are 430 lines of comments open to change him to your initialization of the height corresponding to it.


So the editor won't get high!


End!!! Said Bad big God do not spray ~ ~ This is just to share the exchange, if the wrong point to come on the line thank you ~ ~ ~

add: about Ueditor in the IE7 below call not out of the bug problem resolution, this is the day before the official website, found a person of this problem, because I only people see people love the IE6, also did not go to test, so still others reminded, Now correct the bug solution for IE7 ~ Thank you for this big wet ~




http://www.bkjia.com/PHPjc/897696.html www.bkjia.com true http://www.bkjia.com/PHPjc/897696.html techarticle thinkphp integrated Baidu ueditor Graphics tutorial, thinkphp integrated Baidu Ueditor, based on secondment Teacher's video description of the declaration: the best we can write absolute path is written in absolute path than ...

  • 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.