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 ();