Kindeditor automatically adapts to the Remote Image Width

Source: Internet
Author: User

Many customers are not familiar with the image operations in the kindeditor editor. After the image is uploaded, they do not pay attention to the image width problem. This often causes the image width to exceed the content area, so that some images are hidden and unfriendly.

To solve this problem, the uploaded image automatically adapts to the width of the content area and changes upload_json.ashx.CodeIt is as follows:

 //  It is about 91 rows. The image is saved and operated.  Imgfile. saveas (filepath); string fileurl = Saveurl + Newfilename; hashtable hash = New  Hashtable (); hash [  "  Error  " ] = 0  ; Hash [ "  URL  " ] = Fileurl;  # Region Calculate the Image Width System. Drawing. bitmap BMP = New  System. Drawing. Bitmap (filepath );  Int _ Width = BMP. width; BMP. Dispose ();  If (_ Width> 930 ) // The width of your content area  {Hash [  "  Width  " ] = "  100%  "  ;}  # Endregion  Context. response. addheader (  "  Content-Type  " , " Text/html; charsets = UTF-8  "  ); Context. response. Write (jsonmapper. tojson (hash); context. response. End (); 


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