SQLLite Plugin - Store and retrieve images

3 posts, 1 answers
  1. Nicola
    Nicola avatar
    15 posts
    Member since:
    Feb 2014

    Posted 27 Aug 2014 Link to this post

    I'm developing with AppBuilder an app that displays a list of products (> 30000) in a KendoUI Mobile ListView . At the first start the products are read from a server via json and stored in a local SqlLite database. The list is displayed using a datasource on the local SqlLite DB (this works very well).
    The problem arises for store and retrieve the product's images.
    What is the proper way to download images to show in the list ?
    I have two ideas, but I would like to know, according to you, the proper procedure
    1) I insert in the retrieved json file  the images (base64 converted ??) and save in database? How do I then display them in the list ?
    2) I download individual image files, I memorize them in a folder on the device and then I load them at display time ? How ?
      Can you give me some examples about it?
    Thank you!
  2. Answer
    Tina Stancheva
    Tina Stancheva avatar
    3298 posts

    Posted 01 Sep 2014 Link to this post

    Hello Nicola,

    The approach you can choose will mostly depend on the specifics of the app and the size and number of images you will be storing. Generally I would recommend storing them as a blob in the SQLite database but please be sure to check the Internal Versus External BLOBs in SQLite article as well.

    If you go with that approach you can also have a look at the Storing Blob images in SQLite forum post and the How to Save Captured Picture into SQLite as blob and Retrieve back in Phonegap thread. You can also have a look at our Camera sample which demonstrates how to display an image from a string of Base64 encoded photo:
    <img id="smallImage" src="" />     
    var smallImage = document.getElementById('smallImage');
    // Show the captured photo.
    smallImage.src = "data:image/jpeg;base64," + imageData;

    I hope this information will help you move forward with your development.

    Tina Stancheva

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

  3. Nicola
    Nicola avatar
    15 posts
    Member since:
    Feb 2014

    Posted 01 Sep 2014 in reply to Tina Stancheva Link to this post

    Hello Tina,
    thanks for informations and examples. I will go with storing thumbnail images in SqlLite DB and fullsize images (for the detail page) in file system.
    I read useful information on links.
Back to Top