Pasteimg is a jquery plugin that can be pasted in a browser, compatible with Chrome, Firefox, IE11, and other browsers that use these kernels, such as the famous 360 browsers in the country.
Pasteimg can recognize pictures that are copied directly in the browser, or you can identify the pictures in the copied rich text. You can only identify what is copied in the browser, and the images copied in the operating system are not recognizable.
Pasteimg relies on jquery, easy to use, and after introducing jquery and Paste.image.js, the invocation is as follows:
Copy Code code as follows:
Call the Pasteimage method on a DOM element that requires listening on the pasted event
Calling the Pasteimage method requires passing in a callback parameter
Once you have found the picture in the pasted content, you will call callback
When you call callback, you pass in an array that contains all the pictures
This plugin will be as much as possible to convert the picture to Base64 encoding, but subject to cross-domain restrictions, if not converted, will return the absolute URL path of the picture
$ ("#container"). Pasteimage (function (IMGs) {
IMGs is array so contain all image, can do something ...
});
Plugin Download Address: https://github.com/iyangyuan/pasteimg
There are questions welcome feedback!