This article mainly introduces the jQuery plug-in for image pasting in the browser-pasteimg User Guide. If you need a friend, you can refer to pasteimg, which is a jQuery plug-in for image pasting in the browser, compatible with Chrome, Firefox, IE11, and other browsers that use these kernels, such as the famous 360 browser in China.
Pasteimg can recognize images directly copied in the browser or copied rich text. Only the content copied in the browser can be identified. Images copied in the operating system cannot be identified.
Pasteimg depends on jQuery and is easy to use. After jQuery and paste. image. js are introduced, the call method is as follows:
The Code is as follows:
// Call the pasteImage method on the dom element for listening and pasting events
// To call the pasteImage method, you need to input a callback parameter.
// Call callback once the image is found in the pasted content
// When callback is called, an array is input, containing all the images.
// This plug-in will convert the image to base64 encoding as much as possible, but it is subject to cross-origin restrictions. If the conversion is not allowed, the absolute url path of the image will be returned.
$ ("# Container"). pasteImage (function (imgs ){
// Imgs is array that contain all image, you can do something...
});
Plug-in: https://github.com/iyangyuan/pasteimg
If you have any questions, please feel free to contact us!