Taking photos and accessing photo gallery

Hi All,

I have to make an update in my project and the client asked me to do this: the possibility to take a picture or choose a picture from gallery and putting at the same image component. I've read some posts but I didn't find any info on how to deal with this. Taking a picture it's working, but how to do this? My blocks to take picture are this way:

Any ideas?

TIA,

Kleyber Derick

Why resizing and converting to base64 ?

Because it is saved into a SQLite database and after it is exported to a Mysql remote database

1 Like

OK, what is the problem ?

I need to take a picture or to get a picture from gallery and put at the same image component and I don't know which component I have to use when the user chooses a picture from gallery

Use the ImagePicker component

or you can use the FilePicker component and set the mimetypes

@TIMAI2 thanks for your answer. And how to do to put the image which was got using ImagePicker at the same place as camera does? Something like this (I tested and didn't work, of course):

works for me

In Companion, it didn't. It crashes companion. I''l try in APK.

It crashes in APK too. May I have to consider READ_WRITE_STORAGE permission? I am testing on a Samsung with Android 8, but of course it will run in many Android versions.

Well, in companion, when i did this:

It solved the crash (remember I am using a Samsung with Android 8). Now I've read about Android 11+ that these permissions are not used anymore. So how can I test the Android version?

Reading a little bit more in the forum, I got this:

To cover all Android versions is that right?

Depends if you are publishing to Google Play. If you are, then you will need to remove the Activity Starter that calls for that permission.

No, I'm not publishing into Google Play. Thanks for the advice.

You may need a setting in your manifest.xml as well. There is an extension to help you set this permission. Then you probably would not need to request the other permissions...

Ok. I'm already using the Anke's AllFilesPermission extension. Do you think it is enough?

No reason why not

1 Like

I see no reason at all to request MANAGE_EXTERNAL_STORAGE (on Android 11+). You only need WRITE_EXTERNAL_STORAGE on Android < 11. (This automatically grants READ permission on Android < 11.) On Android 11+ there is no longer WRITE permission, but READ_EXTERNAL_STORAGE on Android 11+12 (Android < 13) and READ_MEDIA_IMAGES on Android 13+.

1 Like

@Anke thank you very much for your advice. I made the changes here and everything is fine.

Thanks again,

1 Like

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