How to save Image with the help of TinyDB?

I was searching for many ways to save the image in TinyDB, so that we can show image later in our app. Well, it is not possible to save the image in TinyDB as TinyDB only saves strings and integers but I found a way which will work for you. :wink:

We use images in two ways in our app:

i) Image from assets.
ii) Image from internal storage which is available in our mobile.

While image from assets are easy to save in tiny db, as we can just store name of file loaded in the asset. See the blocks below:
Annotation 2020-06-14 220058

Now, when we select image from our device, we can get the image path using ‘Image_Picker’ component and then we can store the path value in TinyDB. See the blocks below:

Many Koders might be knowing it while many beginners are still searching for the way to do it. Hope it will be helpful for all those beginner Koders.

Happy Koding! :slight_smile:

22 Likes

Thanks for such a good guide

1 Like

Nice guide.

You are welcome. :slight_smile:

Glad you liked it.

In that way, text can be saved only, and will only get the path of the asset image. If you have to use the external storage, you must first ask permission.

1 Like

Obviously. You need to ask for permission. But that’s a basic thing. Why should I mention it here! :thinking:

1 Like

thank u for help

1 Like

Glad it helped you. :slight_smile:

Thank you for this guide.

1 Like

You are welcome. :slight_smile:

It helps me very much I can even save downloaded image

1 Like

Nice guide for beginners! :blush::wink::tada:

1 Like

Thank you.

Glad it helped you. I would like to give you a suggestion.

If you want to show the downloaded image in your app, don’t save the path in the TinyDB because your app will take more space in the device. You should Taifun Files Extension to show the downloaded images.

Hope it helps. :slight_smile:

1 Like

thank you so much broooo

1 Like

Glad it helped you.
You are welcome. :slight_smile:

1 Like

hey guys but how to load all assets in TinyDB.
When our app open first time.
Is it possible ?

After load assets in tinydb .
open files offline in our app

Nice guide :ok_hand:

1 Like