The PhotoLibrary external object enables you to interact with the photo gallery of the device.
As the HowTo: Use Camera external object in GeneXus enables an app to interact with the photo camera of the device, this API allows the application to save or get an image or a video from the native photo gallery. This article focuses on what this API does and gives an example of how to use it in a Smart Device application.
Code Sample 1: Working with videos
Create the following Panel object
&CompanyPresentationVideo = photolibrary.ChooseVideo()
Variables: &CompanyPresentationVideo is based on Video data type.
There are three cases of different types of images for which the save method can be used.
- To save an image from the DB (attribute)
- To save an image from an URL (ImageVariable.FromURL(url))
- To save an image just taken with the camera (CameraAPI)
Create the following Panel object.
&getFromLibrary = PhotoLibrary.ChooseImage()
&saveToLibFromWeb and &getFromLibrary are based on Image data type
When the ChooseImage method is invoked:
The Save method has no UI interaction to show, but the result of the execution is the image of the url saved on the device's photo gallery.