Image Storage

his game’s platform is WebGL.

I’m making a game where I’m going to show an image of a book.

There are two storage location for the book’s data. MySQL database and local (incase grabbing data doesn’t work (403 forbidden)).

Should I:

  • Use WWW#texture to get the book’s image from amazon. OR
  • Download the book’s image and use local path for images?

WebGL doesn’t have access to a user’s hard drive.

Wouldn’t WebGL compress all the images? It’ll be on server side.

I suppose, WebGL compress images during building a project, so any images download from third party server will not be compressed, I think.

I may have misunderstood you. If you plan to download and save images to a user’s hard drive, you can’t. There is no write access to a user’s hard drive from webgl.

If you download images, you can apply them as textures or sprites just like normal, they will just sit in memory. These are not compressed by the project. (this is with www)

If you asset bundle them, then compression can apply. These can be cached, but I believe most web browsers have a limit on cache size, which is also cleared when the browser is closed (not sure if the second part is true for normal mode, but private mode or the user can clear it pretty easy).

Now, if by download, you mean download and include them in the project, nothing wrong with that. It’s just a normal image file and you can crunch or compress or whatever you want to it.

I tried using Resource.Load but it doesn’t work as intended. (don’t know how to properly call it).

Which way would be more memory efficient vs less data usage?

  1. Using amazon’s image and using WWW to get the texture. (https://images.amazon.com/image.jpg)
  2. Saving images and uploading to server then using WWW to get the texture from server. (http://mydomain.com/image.jpg)
  3. Saving images and uploading them as Texture assets and assigning them to the variable.
class book{
  string book_name;
  Texture book_texture; //Set this texture to the image in inspector
}

Which method would be best?