javascript - How can I get Image data or the path of cache of Image on WebPage in chrome or firefox? -


I am creating a plugin (add-on) to upload an image on any page I only use the URL of the image I can get it, but I have to get the image data or local cache of the image.

I have used it in my detail via canvas via JavaScript

I have created two functions to get image data from the canvas first using the "ToDataURL ()" method (gives an image of the current canvas as an image that you Can be used as a source for other canvas or HTML elements (such as IMG), and then Number to obtain the Blob object to access the data.

  function getImageDataURL (url) {var data, canvas, CTX, blob; Var img = new image (); Img.onload = function () {canvas = document.createElement ("canvas"); Canvas.width = img.width; Canvas Het = img height; Ctx = canvas.getContext ("2D"); Ctx.drawImage (IMG, 0, 0); Try {data = canvas.toDataURL (); Blob = DataHitblock (data); } Hold (e) {// handle errors here (e); }}; Img.src = url; }; Function daturaeobob (dataur) {var bistring = etob (daturae split (',') [1]); Var mimeString = dataURI.split (',') [0] .split (':') [1] .split (';') [0]; Var ab = []; (Var i = 0; i & lt; byte string; langati; i ++) for ab.push (byte string.charcodeet (i)); Return the new Blob ([New UIT 8 array (AB)], {Type: MimeString}); };   

Here in the "Blob" variable we have a bomb object with full image data.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -