Xheditor Editor Upload screenshot image grab remote picture code

Source: Internet
Author: User
Tags base64

Xheditor is a very good open source editor, easy to use and very powerful.

Share a Xheditor directly upload problem solving method.

First step, set parameters
Localurltest:/^https?:\ /\/[^\/]*? (hsa\.com) \//i,remoteimgsaveurl:' http://www.hsa.com/test_up.asp ',

Parameter description:
localurltest: means check if it is the address format of the site.
Remoteimgsaveurl: If the check out is not a picture of this site, then the image of the SRC attribute value will be sent to the address set by this parameter.

The second step, the service side processing picture

The following is an example of ASP code, other languages similar, as long as the receipt of image information to do processing.

<%subfolder=year (now) &month [now] &day (now) &hour (now) &minute (now) &second (now ()) "Create the name of the subfolder for the current day picture=trim (Request. Form ("URLs")) 'receive post image content picture=replace (Picture, "Data:image/png;base64,", "" ") path=subfolder& ". jpg"Xmlstr= "<data>" &picture& "</data>"Dim xml:set XML=server.createobject ("MSXML2. DOMDocument ") Dim Stm:set stm=server.createobject ("ADODB. Stream ") Xml.resolveexternals=falsexml.loadxml (xmlstr) Xml.documentElement.setAttribute"Xmlns:dt", "Urn:schemas-microsoft-com:datatypes"Xml.documentElement.dataType= "Bin.base64"STM. Type=1 'adTypeBinarystm.Openstm.Write xml.documentElement.nodeTypedValuestm.SaveToFile Server.MapPath (path) STM. CloseSet xml=nothingset stm=nothingresponse.write ("http://www.huhangfei.com/" &path)%>

After processing succeeds, the address of the picture is returned, and Xheditor automatically replaces the address in the editor with the returned picture address.

Xheditor Editor upload image crawl remote picture code

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.