0

I am making an extension which grabs the image from any website and upload it to our server, here problem is if I am trying to upload like 1000-2000 images then the targeted website gives 429 while making a file object since we have already made 1000 request to load those images in DOM & now again reading it to make file object, so is there any way to grab image data which is already loaded in DOM without making one more request?

Example: Suppose I am trying to grab images from google, so first I show all those images in a dialog box (generated by extension) gives the user a choice to select/unselect images which they want to upload, then on submit I generate the file object and send it to the server.

So here I am making 3 requests, first making a request to load those images on the website itself, grab the image URL and load it in the dialog box at last read it to make file object, so is there a way to do it in a single request?

Dheeraj Agrawal
  • 2,347
  • 11
  • 46
  • 63
  • 1
    @T.J.Crowder, here OP is quite clearly asking for remote images. Canvas export methods are tied by the crossOrigin policy. He won't be able to get his imageData from this method. To OP : you'll need a proxy server that will make a single request to the original images, then serve it cleanely to your front-end. The best way in your case is to require it through xhr, with the `responseType` set to `blob`. You can display it thanks to the `URL.createObjectURL` method, and download it directly front-side as a blob. But if you want to save it on server, you don't care ;-) – Kaiido Nov 08 '16 at 12:47
  • 1
    @Kaiido: Doh! Of course he/she is. Unless they've marked `crossorigin`, the dupetarget wouldn't help. – T.J. Crowder Nov 08 '16 at 13:39

0 Answers0