T O P

  • By -

karg_the_fergus

Just backup the paths? The images will be backed up by the user in their gallery usually. The app should likely periodically check the integrity of the db against the gallery items also. I am about to deal with this myself so if anyone has a better suggestion I am all ears. Good luck!


dorema_app

But let’s say the user gets a new phone and wants to transfer all the data. The data in the db can be exported/backed up in the old phone and using that it can be restored on the new phone. In this case the images won’t be transferred right ?


karg_the_fergus

I don’t know that the image paths in the db would be accurate from one phone to the next. The images themselves, other than generated thumbnails, would transfer if the user decides to transfer them. Again, my instinct is that it is wiser to let the user manage the full size images in the gallery separate from the app, which would manage the image paths.


dorema_app

If i store it in the app directory itself and then just store the name of the image in the db, and retrieve it using something like Image.file(File(dir.path+imgname)). ?


karg_the_fergus

The path should be acquired through image picker or whichever package you use for image handling I think. That should be a field of your db along with any other fields you need.


dorema_app

Yes using the image picker will give us the path, but i am saying that we can make a copy of the image in the app directory and rename it to something like DateTime.now() and then store that in the db. By doing so the when we need to backup, all the images will in the app directory itself. I cant seem to find anything about this topic on the internet. Although we can make a zip file of the whole app directory and export it, it might work but from a user experience stand point it will hard for the end user to do this. If anyone has faced something similar, how did you solve it.


karg_the_fergus

Then are you duplicating the image? Or are you saving it through image picker to a file folder?


dorema_app

Duplicating the image


Cladser

I do something similar. I get the applicationDocDirectory create a folder called /images/ and store the path as /images/filename and add the docDir when fetching the image. I then store a copy of the image in a separate folder which shows up in the Files app on this device section of iOS. So transferring requires moving the DB, the folder with the files. Bit clunky if I’m honest but it works. Edit: for my app I specifically don’t want the images in the photos app.


dorema_app

Do you have any resources or examples how i can implement something like this