Load image from gallery in OS 10

Hi,


In outsystems now for version 9 we were using custom action 

SyntaxEditor Code Snippet

RunJavascriptOnDeviceReady("OutSystemsNative_LoadImagePreparation('" + ButtonId + "', '" + InputId + "');")

to load image from devices image gallery.


Is there a way to access images in gallery without cloning Snow module?


Thank you.

Hello Nick.

Is it for a Mobile App or Web App?

Thanks

Hi César,

It is for mobile. It seems like I've to use file upload widget - the native camera or gallery menu appears. There is a bit of lag between click on placeholder and menu to appear.

Solution

Hello Nick.

You can also install the Camera Plugin from Forge. Then, just duplicate the TakePicture client action (and give it a meaningful name). Open the JavaScript node in that client action and add a new parameter to getPicture.

According to the documentation, getPicture allows you to define a source type. Default is Camera.PictureSourceType.CAMERA, but you can use Camera.PictureSourceType.PHOTOLIBRARY and it should go to the recent pictures. So, in the getPicture, add another parameter (after destinationtype) like suggested in the documentation:

, sourceType: Camera.PictureSourceType.PHOTOLIBRARY

Remember that this will be shared by all apps that use the plugin.

Thanks


Solution

Thank you for suggestion César - I will try it also. 

Hello Nick.

Not sure if you really need native dialogs to achieve what you want, but there are some plugins available that allow you to do that (examples: ActionSheet, Dialogs Plugin).

Thanks

César Afonso wrote:

Hello Nick.

You can also install the Camera Plugin from Forge. Then, just duplicate the TakePicture client action (and give it a meaningful name). Open the JavaScript node in that client action and add a new parameter to getPicture.

According to the documentation, getPicture allows you to define a source type. Default is Camera.PictureSourceType.CAMERA, but you can use Camera.PictureSourceType.PHOTOLIBRARY and it should go to the recent pictures. So, in the getPicture, add another parameter (after destinationtype) like suggested in the documentation:

, sourceType: Camera.PictureSourceType.PHOTOLIBRARY

Remember that this will be shared by all apps that use the plugin.

Thanks



Hi,

I have one question. If I want to chose from camera or photolibrary when I click the button? How I do that?

Can anyone please upload sample mobile app with this functionality of selecting/showing images from gallery in mobile view. If possible there should be an option to select Camera or Gallary.

 Hello Amol.

Were you able to implement the suggestion from the post above?

Thanks

César Afonso wrote:

 Hello Amol.

Were you able to implement the suggestion from the post above?

Thanks


Thanks for the inquiry, Cesar.


No, I didn't get the perfect solution for this.

When a user clicks on the Select Images, There should be 2 options Camera and Gallery, Then the next process to show all selected or captured images in the list.

When selecting some kind of images the app crashes when using the code to load from the gallery.

Service center is returning 

"A fatal error has occurred. Please contact OutSystems support: For input string: "raw:/storage/emulated/0/Download/P_20181005_163705.jpg" in the errors tab and in the general tab

"There is no callContext registered with Id '108'"