Captures or views a photo or video using the device's camera.
Description
Reads data from the specified image file. If the file is over 4 MB, calling this function may cause memory issue in PB 9 or earlier version. You can upgrade your source code to PB 10 or later, and then call the function of the Appeon Workarounds PBL for the corresponding PB version.
Syntax
camera
.of_getfiledata
( value string as_filepath
)
Argument Type |
Argument |
Description |
---|---|---|
eon_mobile_cameraex |
|
The name of the eon_mobile_cameraex object. |
string |
|
The full path of the file you want to read. |
Return value
Blob.
Description
Opens the album for the user to select a photo or video.
Supported on mobile client only.
Syntax
camera
.of_openalbums
( ref string as_filepath
, ref blob
ablb_data
)
camera
.of_openalbums
( ref string as_filepath
)
Argument Type |
Argument |
Description |
---|---|---|
eon_mobile_cameraex |
|
The name of the eon_mobile_cameraex object. |
string |
|
In iOS, it returns the full path pointing to the selected file in the sandbox plugin directory. The selected video or photo file will be copied from the album to the plugin directory of the current application's sandbox. The files in this plugin directory will be removed when the application exits. In Android, it returns the full path pointing to the selected file. |
blob |
|
Returns the file data of the photo file or video file. The file data could be saved into the database via the UpdateBlob SQL statement. |
Return value
Integer.
1 - Select a photo file successfully, and as_filepath will return the full path pointing to the selected photo file.
2 - Select a video file successfully, and as_filepath will return the full path pointing to the selected video file.
0 - Cancel selecting a file from the album.
-1 - It is called in PowerBuilder or PowerServer Web, or there is an error.
Code example 1
eon_mobile_cameraex ln_camera String ls_filepath Integer li_filetype Integer li_return li_filetype = 2 // Simultaneously displays the photo or video in the album ln_camera = create eon_mobile_cameraex li_return = ln_camera.of_openalbums (ls_filepath)
Code example 2
eon_mobile_cameraex ln_camera String ls_filepath Integer li_filetype Integer li_return Blob lb_data li_filetype = 2 // Simultaneously displays the photo or video in the album ln_camera = create eon_mobile_cameraex li_return = ln_camera.of_openalbums (ls_filepath, lb_data)
Description
Opens the default camera application and uses it to take a photo or record a video.
Once the photo or video is taken, the camera application automatically closes with all the files saved in the album, and returns to the current application.
The supported video file format is MOV, and the supported photo file format is JPG.
Supported on mobile client only.
Syntax
camera
.of_takefile
(
value integer ai_filetype
, value boolean
ab_allowedit
, ref string
as_filepath
)
camera
.of_takefile
(
value integer ai_filetype
, value boolean
ab_allowedit
, ref string
as_filepath
, ref blob
ablb_data
)
camera
.of_takefile
(
value eon_mobile_str_cameraoption
astr_option
, ref string
as_filepath
)
camera
.of_takefile
(
value eon_mobile_str_cameraoption
astr_option
, ref string
as_filepath
, ref blob
ablb_data
)
Argument Type |
Argument |
Description |
---|---|---|
eon_mobile_cameraex |
|
The name of the eon_mobile_cameraex object. |
eon_mobile_str_cameraoption |
|
Sets the camera parameters. See variable list of eon_mobile_str_cameraoption. |
integer |
|
Sets the type of file to take. The camera application will be set to this type by default when it is opened. Users can also manually switch the type in the camera application. 1 - Takes a photo. 2 or any other integer - Records a video. |
boolean |
|
Sets if the file is editable after picture-taking or video-recording. |
string |
|
Returns the full path pointing to the file in the "plugin" directory. In iOS, the video and photo files will be saved to the iOS album, as well as to the "plugin" directory of the current application's sandbox. As there is restricted access to the directory of iOS album, only the "plugin" directory can be obtained and returned. The files in this "plugin" directory will be removed when the application exits. In Android, the video and photo files will be only saved to the "plugin" directory of the current application's sandbox. The files in the "plugin" directory will remain when the application exits and will be displayed when the Android album is opened by of_openalbums. |
blob |
ablb_data |
Returns the file data of the photo file or video file. The file data could be saved into the database via the UpdateBlob SQL statement. |
Return value
Integer.
1 - Take a photo successfully, and
as_filepath
will return the full path of the
photo file, and return empty string if the picture-taking is
cancelled, or if there is any error.
2 - Record a video successfully, and
as_filepath
will return the full path of the
video file, and return empty string if the video-recording is
cancelled, or if there is any error.
0 - Cancel taking a photo or making a video.
-1 - It is called in PowerBuilder or PowerServer Web, or there is an error.
Code example 1
eon_mobile_str_cameraoption lstr_option eon_mobile_cameraex ln_camera String ls_filepath Integer li_return lstr_option.i_filetype = 1 // Takes the photo lstr_option.b_allowedit = true // The photo is editable after picture-taking ln_camera = create eon_mobile_cameraex li_return = ln_camera.of_takefile (lstr_option, ls_filepath)
Code example 2
eon_mobile_str_cameraoption lstr_option eon_mobile_cameraex ln_camera String ls_filepath Integer li_return blob lb_data lstr_option.i_filetype = 1 // Takes the photo lstr_option.b_allowedit = true // The photo is editable after picture-taking ln_camera = create eon_mobile_cameraex li_return = ln_camera.of_takefile (lstr_option, ls_filepath, lb_data)
Description
Struct.
Optional parameters to customize the camera settings.
Property
Type |
Variable Name |
Description |
---|---|---|
integer |
|
Sets the type of file to take. The camera application will be set to this type by default when it is opened. Users can also manually switch the type in the camera application. 1 - Takes a photo. 2 - Records a video. |
boolean |
|
Sets if the file is editable after the picture is taken or the video is recorded. |