2

My app will store many photos arranged within one drive file, like a google doc with many images inline. The api to update the file, however, requires a full body upload for each save, so when my user inserts his tenth image, the previous nine images will have to be REuploaded as well. The realtime document looks promising for partial updates, but it has a limit of 10 MB per file.

Are there any established ways of solving this problem? I can upload the images to a different datastore and just hold references to them in the drive files, but then I have to manage permissions for downloading them, pay for storage and bandwidth, etc. How are apps with large file sizes getting around the bottleneck of reuploading the entire body for every save?

Riley Lark
  • 20,660
  • 15
  • 80
  • 128
  • I just looked into how Google Docs is solving this issue, and it seems that they just store images at random urls on googleusercontent.com with no other permissions checking, and the images are not part of the doc file itself. I guess I could go this route, but keeping track of those images is going to be a huge pain! – Riley Lark Nov 25 '13 at 04:50

1 Answers1

1

Regarding storage you could store them in the same drive and give them public permissions. Also for manipulating the gdoc you could write a little apps script backend that does the editing. DocumentApp has access to more things (paragraphs images etc) than dealing with the raw files api.

Zig Mandel
  • 19,571
  • 5
  • 26
  • 36
  • Interesting idea, but I'd hate for my app to break if the user deletes or unshares those files, and I think it would be pretty confusing to see all of those extra files in your drive all of a sudden. – Riley Lark Nov 25 '13 at 21:39
  • you can put the image files inside a folder so they dont spill into the root of the user's drive. Now if you use apps script as a backend for this, you dont need to save the images anywhere else, you can get them from the document itself. Actually you wont even have to get them if all you are doing is appending new content as a new paragraph. See https://developers.google.com/apps-script/reference/document/inline-image – Zig Mandel Nov 25 '13 at 21:57