简体   繁体   中英

Strategy for exporting Android SQLite Database with large number of photos to user-friendly output

I'm looking for some help on a strategy for exporting data from an android app I recently developed. I am a fairly competent coder, but I am not formally educated in this area, so I am hoping someone can give me guidance on what road to go down as a possible solution for my problem.

I have an app which is basically a type of journal that stores text and references to photos in a SQLite database. Each journal entry has multiple String columns associated with it and a sub-table which has file paths to photos associated with that entry. Each entry can have up to six photos, and I expect the journal to eventually have anywhere from 100-300 entries, so I'm talking about a large amount of photo references.

Obviously, storing all this data locally on the device is not ideal. I don't really have the resources to do any sort of cloud-based automatic backup, but I want some way to extract it so that it doesn't risk being lost if the phone is lost, SD file paths get corrupted, etc. At a minimum, I would like to be able to make some sort of zip file or something that the user can then easily transfer to their computer.

Accessing the data from the database isn't a big problem, but I'm curious how someone would manage all of these photos while keeping them associated with entries. I want to find a solution that creates an aesthetically pleasing and usable output for the user, not just a data dump of all of their files and text.

My current thought is to basically build an HTML "book" of the user's journal and make it into a zip file.: - Build an HTML-based template page for what the entries would look like, with thumbnails for the photos - Extract each journal entry and convert the strings to HTML - For each journal entry, create some sort of directory structure and copy the attached photos into that structure - Create thumbnails for the newly copied photos in the html journal entry page - Create an index page which links to all of the journal entries - Slap the whole thing in a zip file and store it on the users device so they can extract it.

I have a few concerns with this approach. First, it will need to duplicate all of the photos, so the users may run out of space. Second, it will generate a lot of files. But, it will allow me to have an index, details page, and full sized photos.

Would this approach be a reasonable method? What would some other options be? Convert to PDF pages? Place photos IN the database file as BLOB?

Any help or guidance would be very much appreciated! Thanks!

You can use Cloudinary which is a CDN where you can store your all images and can fetch any size or quality or can crop the picture also. Here check This link

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM