Load image from gallery in OS 10

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