How to save webpages and images using tinyDB?

I am creating an application in which I added a blog area. But I want to save the thumbnails of my posts and also the html page. Here is how everything works:
If the mobile is connected to internet my app requests and gets three lists(Title, Subtitle, Thumbnail) it stores the title subtitle and the related post’s data with as dictionary using tinyDB.

But is there no option to save images or html(containing css and images) using the same way?
Thank you in advance for your help!

You didn’t save image but you can save image url in tinydb
And for html css it’s also a text than you save it also ( use inline css)

Yes, I can save html as string, but is there anyway to save images without showing them in gallery and “without creating new directories(optional)”

you just need to store the url of images in tinydb and use async image extension to show images

1 Like

I also said that

1 Like

But I want to show them offline too.
I’m saving urls now, but I want to make it more faster even with slow internet or no internet.
Is there any way to store images as cache.

you need to download images from the url and store the file path in tinydb and then you can see them offline too

Use this extension

2 Likes

But this is used for online na?

Yes, but once the image is loaded I can store it offline without showing it in gallery

This extension load first all image online and then save it in android cache folder to load offline whe. Needed

1 Like

You can use extension “image to base64”.
First encode image and save to tinydb. If you wanna use image decode text from tinydb.
I use this extension to save image from camera and convert to text(base64).

2 Likes

Hi @sayidtarmizi Welcome to Kodular Community
Your answer is correct and best. :+1:

3 Likes

if you store/download images in your ASD (App Specific Directory) it well not show in gallery.

store it in a directory, which starts with a dot, for example ./myHiddenDirectory
or store it in a directory of your choice but start the image name with a dot, for example .myHiddenImage.jpg

Taifun

Can you explain me more with an example?
how to store images in app specific directory(what is it’s path)?

see this topic:
https://community.kodular.io/t/filetools-some-tools-to-work-with-files/40051

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.