pasteimg is a jQuery plug-in that can paste images in the browser. It is compatible with Chrome, Firefox, IE11 and other browsers using these cores, such as the famous domestic 360 browser.
Pastimg can identify pictures copied directly in the browser, and can also identify pictures in copied rich text. Only content copied in the browser can be recognized, images copied in the operating system cannot be recognized.
Pastimg relies on jQuery and is simple and easy to use. After introducing jQuery and paste.image.js, the calling method is as follows:
//Call the pasteImage method on the dom element that needs to listen for the paste event
//Calling the pasteImage method requires passing in a callback parameter
//Once an image is found in the pasted content, callback
will be called
//When calling callback, an array will be passed in, including all pictures
//This plug-in will try its best to convert the image into base64 encoding, but it is subject to cross-domain restrictions. If it cannot be converted, 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 download address:
https://github.com/iyangyuan/pasteimg
If you have any questions, please give us feedback!
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn