Champion
58
Views
7
Comments
Solved
[Camera Plugin] How to get the binary from the URI that the new MediaResult method returns?
camera-plugin
Mobile icon
Forge component by Hector Gordin
Application Type
Mobile

Hello,

I thank you for changing the way camera was working to this method since I was also having issues with crashes due to the OS destroying the app when it was in the background while we were taking a picture.
But now I'm trying to update the plugin to use the new method and I can't find a way to get the binary from the URI, I can't find any sample demo app and using the FilePlugin to get the binary from the URI is not working, already tried parsing the URI and trying to open from file hoping it was a small plugin defect that i could get around but to no luck either.


File plugin returns error 5 Encoding Error when opening the URI that Camera Plugin returns in the media result.

How are we supposed to get the actual binary?

Best regards,

Frederico Sousa

Solution

Hello Frederico,


Yes, the "Thumbnail" is a smaller version of the media saved in storage.


The URI is for exactly what you said, avoid working with binary data. For example, you can use the URI to upload your media assets to a server, as we show in the plugin's documentation page, in the "Upload media assets from URIs" section: https://success.outsystems.com/documentation/11/extensibility_and_integration/mobile_plugins/camera_plugin/

Best regards,
Alexandre Jacinto 

Hello Frederico!


Thank you for your interest in our Camera Plugin.

The binary comes in the "Thumbnail" field of the "MediaResult" output parameter of the "TakePicture" client action.

Please let us know if you need anything else.

Best regards,

Alexandre Jacinto

Hey, thanks for the quick answer.


Doesn't that defeat the purpose of sending a uri to prevent using too much of the device's memory while the app is in the background?

I suppose the thumbnail is a smaller version than whatever is saved on the storage, am I wrong?

What's the uri for then?

Best regards,

Frederico Sousa

Solution

Hello Frederico,


Yes, the "Thumbnail" is a smaller version of the media saved in storage.


The URI is for exactly what you said, avoid working with binary data. For example, you can use the URI to upload your media assets to a server, as we show in the plugin's documentation page, in the "Upload media assets from URIs" section: https://success.outsystems.com/documentation/11/extensibility_and_integration/mobile_plugins/camera_plugin/

Best regards,
Alexandre Jacinto 

AH, here i was complaining about no documentation and there was a updated document with everything i need.


That document is listed as 7.1.3 in this forge component, and since MediaResult came with 7.3, i just assumed it was outdated.


But I guess what's outdated is the 7.1.3 tag :D

Thanks a lot!

Hi Frederico, 


You're welcome! Glad to know you managed to get what you wanted. We will look into the documentation tab in the plugin's Forge page to see what we can do to avoid this confusion in the future.


 Best regards,

Alexandre Jacinto

Does this mean that local manipulation of the original picture is no longer possible? 

We used to resize the image first to prevent large uploads and unnecessary use of storage on the server and now we have to change that whole algorithm with this update. 

I don't understand the change to be honest. 

Also, since we are now obligated to to call REST services from devices, how am I going to make this secure? 

In the mean time I figured out that client action GetFileDataFromUri  from the FilePlugin works as well, that way you have the binary on the client side and you can do with it whatever you want. Seems to work so far....

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.