Good approach to store picture in native app

I am writing a catalog viewer native app for android. I would like to know what is a good approach to keep my catalog picture. ie database in base64 string or physical file .

My catalog pictures are able to sync with database server. They are allow to add or delete after sync from database server


I would keep save the image as a physical file and keep its name in the database.

I have uploaded all my image files into web server, And the image files will convert as base64 string and keep in mobile native app after sync with my web server. Then image is converted back to image as image1.innerHTML="". This is fine, however, when the image converted back from base64 string, it does not fix to my image control’s height and width

on the left is actual image, but it seems like not fix to my image size

Any idea?


Three thoughts:

  1. Set the size manually. Hide the div, convert and add in the image, set the size and then show the image.
  2. Apple especially, has a bad habit of caching images. The workaround is to put a random number at the end of the file name which will force an image refresh. Something like:
src = "img/user.png?" +Math.random();
  1. If you’re using jquery, add this little extension in after jquery is loaded:
// this extends jquery and adds an element redraw function
// use it like this: $("#").redraw();
// just make sure jquery is loaded before this
$.fn.redraw = function(){
    var redraw = this.offsetHeight;

The above extension will not change the elements height but it tricks the system into thinking it has and it will redraw the element and typically correct some of these type issues.