1

Well guys i was looking many hours for internet and i couldn't find the answer.

I have an URL with an image like this:

http://maps.google.com/maps/api/staticmap?center=Berkeley,CA&zoom=14&size=400x400&sensor=false

I need to load this image using ajax or another tool and later convert it into a blob to save in my database.

Thanks

geocodezip
  • 147,872
  • 13
  • 194
  • 222
Franz Torrez
  • 49
  • 2
  • 3

2 Answers2

2

Blit the image into a canvas element, generate a dynamic URI from the canvas, decode the URI into bytes, construct a blob, add to a FormData object, and submit with XMLHttpRequest.

See here.

PS - because the image is served from Google, you will need to use a proxy to circumvent "same-origin" security policy, as described in my linked post.

Community
  • 1
  • 1
Joe Coder
  • 4,136
  • 26
  • 38
1

That is against the Terms of Use.

See this FAQ which addresses your question.

geocodezip
  • 147,872
  • 13
  • 194
  • 222
  • 1
    Actually it's only "storing and serving" that's against the terms. OP is simply looking to store, which could be a fair use. – Lyn Headley Sep 26 '12 at 23:06
  • That is only the wording of the FAQ. I believe what I said, that saving it is against the terms, but [IANAL](http://en.wikipedia.org/wiki/IANAL). – geocodezip Sep 26 '12 at 23:31