So I've got a unique system going on which is spread across 2 apps and 1 website. All 3 components of the system will share the same data source now each user has 1 and only 1 image to upload which will be their profile image. I'm debating if I should store them in the file system or the database the trade here are equal in my eyes. Storing them in the file system I'll have to retrieve them in 3 different systems from one server hassle.. on the other hand storing them in the DB could potentially make the DB slow.
One thing I see happening here is what if I make an images table and not back it up and just have all images reference an image in the images table. Worst thing that can happen is I'll lose all images.. xD which isn't really significant
I'm using windows azure to host my database
my website will run asp.net on windows azure and I'm using azure mobile services to serve apps
Since the same image is used by 3 applications, I would recommend using a central place for storing the image instead of storing it locally in the application. The advantage you will get is that if a user updates the image from any application, changes will be reflected in other applications as well without worrying about the synchronization hassles.
However instead of using a database table for storing images, use Windows Azure Blob Storage. It is meant for that purpose only. Furthermore your data is replicated 3 times within same data center and optionally you could geo-replicate the data for additional redundancy. With blob storage you don't have to worry about backups as well.
Related
We're building an app (ios and Android) that lists ~1000 records. This list is displayed in a tableview/listview with an image related to each record displayed in the view. When a record is selected, a detail view opens up and displays multiple images related to that record.
What are some of the best (and simplest) ways to organise these image assets in both platforms and access them?
More info:
There is also a few lines of text related to each detailed screen. This also needs to be handled.
The images should be packaged with the app as the app will be used offline a lot.
For iOS ::
Collection view for display once selecting would probably be the most simple.
1000+ images? That is pretty big and will bloat your ipa for the store, also it locks you into having to add all images. You should really have those on a server and download them when needed, or download all on first load or something.
I'd have thumbnails or something for the tableview then when selected download the related images into a directory on the app bundle. That temp directory can act as your source. Just create a wrapper that reads the directory and creates and ImageObject for each image found (image and text description if available) and compile into a Dictionary with the key being whatever identifies each record.
The wrapper is an important layer when compiling all the images associated with the records because you can swap the implementation if needed as long as you maintain the interface contract of using a Dictionary to organize your data.
The tableview displays all the records and downloads the thumbnails when needed (this is pretty standard). Selecting the record then goes to a collection view that asks the wrapper for the records images/descriptions. The wrapper grabs the either from the system or the server and returns the dictionary. Then the collection view uses the dictionary as the data source displays all the images with the image descriptions
That's how I'd do it based off your vague specs anyhow.
First of all, it is definitely not recommended to store them in Core Data. Core Data has low performance and can't be cross-platform. I don't see any benefit in storing images into Core Data, and you need to serialize it when displaying.
I recommend that you store your records in a SQLite database. SQLite is a high-performance, cross-platform embedded database that is fully supported by both platforms.
Create a SQLite 3 database and store all the records, but there are two cases for the image:
The image is very small, such as the icon of the button, the number of images is less, then you can store them directly in the database.
The image is large, the number is large, then it should be stored in the system, only store the name or path of the image into database.
I recommend storing the image in the system, because blob data can't be queried and indexed. It's more troublesome when you need to do something with the image. Reading from the system will be more faster than reading from the database.
Images should be compressed before packaging. If the image is large, creating a corresponding thumbnail will improve UI fluency.
Then you just need to copy the database and images (if not stored in the database) to your apps. When the data changes in the future, you only need to replace the database for your apps.
I'm creating a native android application which loads images of users. (An image of the user that is shown as in WhatsApp, messenger, etc). I need to update the image once a user changes it.
One approach I'm aware of is saving images on a separate server and saving the link to the image in the database. While loading, fetch the image from the specified url and cache it.
Another is saving the image as blob (don't think it's efficient) and cache it.
What are the approaches that I have to save images and retrieve them efficiently?
I'm using spring boot and couchbase as backend
If you save a link:
Often you can store the image on a cloud server that's less expensive
You have to retrieve the link, then build the code to retrieve the image
Checking for updates is at least slightly more complicated
If you use Couchbase Lite:
New images can propagate easily to the client
Storage is efficient
Blobs are stored as separate files
The associated document overhead is tiny
Simple to implement
I am building a mobile appfor Reporting and Business Intelligence. The app will show a live stream of billing, payments and other data to management of a company which is doing business across 70 different physical locations. The idea is to see what is happening in the business across all locations as a live stream on line graphs on your tablet.
However the question I have in mind is that with billing and payments data across 70 locations, this stream of data will be huge, and continuous. Over 1 year this dataset will exceed 10GB. Should so much of information be kept in a sqllite database on a mobile? Are there any best practises on handling such large datasets on a mobile app? Tx.
For large databases you should use Realm. It is noSql db and it is more efficient with large data sets. But, more importantly, you can store realm database as ordinary file on SD card.
As I understood from your description, you need to store very large volume of data, but you don't have to access any portion of it (access latest data immediately and previous data with some delay).
You can create system's architecture in that way, so there will be 'database adapter' for Realm, which will take one file, extract data from it, convert it to anther format (in background, of coarse) and then upload those data to AWS or any other cloud storage.
If you use Realm, you can just monitor file size (database is ordinary file), and, if it exceeds given value, create new database file and process previous file in the way I mentioned.
Another approach - interpolate your data and save interpolation factors, but there is math envolved and some data will be lost.
Yeh, all data is kept on remote server, and you uploading some pieces when you need it. Don't know if it's what you searching from.
Is it a good idea to store images retrieved from the web server via a web service in SQLITE DB. I am working on this android app that retrieves a lot of images from a web server and places them in a listview. And I would like to store the first 100 images in some storage area within an android device(That is after compressing them.) when a user first opens the app so that the app doesn't reload a fresh the next time the user opens the app . So, I am looking at SQLITE as one of my top storage options and I am not sure whether there could be a better way to doing this for the sake of improving the app performance. I have seen the question asked at Should i store images in SQLite database? and its answer, which a little fuzzy to me. Your opinion is highly appreciated. Thanks in advance.
Depends on the size of images - If the returned result of your query is going to be more than 1 MB (the binder limit) then you would have to store them as files and only store the URIs in the dbs.
For example you can look at the Contacts Provider - the thumbnails are stored in the db but the full images are not - only URI of the full image is part of the contacts database.
The question you linked too explains the best practise.
Generally, you should store the actual image files in the filesystem or memory card of the device.
Then your app can find references to them in your database
e.g.
SELECT avatar_image FROM profile WHERE user_id = 1; would return the local device file path of your stored image that can then be loaded into your ImageView.
I am making an offline game app using Phonegap. I used to store everything online for my previous web app projects, but this time I want to try local storage.
I see there are couple of options for Phonegap:
- WebSQL, it seems just a SQL database.
- IndexDB, which is not fully supported by Phonegap
- File system. I mean I can cache the data on the device's local file system in my own pattern like most of the PC games do.
Suppose it is a RPG game and I need to store maps, characters, characters' items, characters' relative position in their map, etc...So I may often need to joint 4~5 tables in a relational database and deal with thousands of records. Is it going to be a heavy burden for WebSQL? If I use WebSQL, how will it be stored on the device's file system? If WebSQL, how can I let the app load the initial settings of the game when the app is running its first time?
I am also wondering how to load these data during the runtime of the app. Do I cache everything into the memory when the app is initialized, or only retrieve the piece of data I need when I need to use it?