The first time I added covers for books, I did it with AJAX directly trough Google Books. But this is illegal and shows a “Cross domain” error. The quick solution was to disable my browser security. This workaround was good for testing and development, but not in real world. In this way, every client of my app should also disable his security to view Books in 3D. It was unacceptable.
@ Flickr, Scott Wendling
1. My first idea was to use CORS(Cross origin resource sharing), to send from my server an header with
Access-Control-Allow-Origin: *
Clearly that didn’t helped me.
2. My second try was to render from server all the images like this:
<html>
….code..
<div id=”images”>
<img src=”..from google books servers…”>
<img src=”…..”
…..more images…
</div>
…code..
</html>
Again this might seem to work if you just want show images, but you are not allowed to draw them on the canvas.
3. Third idea was to continue to do AJAX requests, but to my server and my server to do a request to Google books; then to serve the actual client with the image.
This way actually works for a few times, but after a while Google blocks my IP for too many requests.
4. The final idea is to save images on my server. If a client does a request for an image that I don’t have I do a request to Google, but if I already have the image, the server just delivers it.
This one actually have the disadvantage that my server is going too need a lot of memory to store those images. But for now it seems to be my best choice.