TakePhoto
Definition:
TakePhoto(datasource, field)
Description:
Allow the user to take a photo using the device's camera.
Platforms:
All
Parameters:
datasource - required
Name of Data Source as defined within your Project in which to save the photo.
For ADO databases, include the name of the table containing the field in which the photo will be saved as well, in the format:
<datasourcename>.<table name>
Generally, this Method would only be used with database data sources.
Click here for more information about the format of this parameter.
field - required
Name of the field within the Data Source in which to store the photo. See Notes below for information on data types supported.
Returns:
0
User cancelled camera.
1
Photo taken.
Notes:
-
The operation of TakePhoto can be altered using the following options available with the SetApplicationOption Method:
CAMERA_MEGAPIXELS - Specify maximum size, in megapixels, for an image taken with the device's camera. The Client or Standalone App will attempt to take a photo using a resolution which will result in an image equal to or greater than the size specified here. If the returned picture is larger (in megapixels) than the value specified here, it will be downscaled so that it is less than or equal to the specified size. If the size specified exceeds the device's capabilities, photos will be taken at the maximum size available. If set to 0 (zero) or below, the default value of 2.1 will be used.
CAMERA_TYPE - determines whether a call to TakePhoto should allow the user to take photos using the device's native camera app, take photos using the enhanced camera facility built into the Digitise Apps Client, import existing photos or allow the user to choose which of these they want to do each time TakePhoto is called. The option to choose which camera to use is only relevant to Android and iOS devices; on the UWP and Windows Desktop Platforms, the Digitise Apps Client or Standalone App will always directly access the device's camera to take photos, whichever camera type is selected.
If you do not specify this option, by default TakePhoto will allow the user to take photos using the default camera app on Android and iOS devices and the camera functionality built into the Client on the UWP or Windows Desktop Platforms.
PHOTO_OVERLAY_TYPE – determines whether a timestamp and/or location data should be added to photos taken. If you do not specify this option, by default time and location data will not be added to photos.
PHOTO_OVERLAY_HORIZONTAL_POSITION and PHOTO_OVERLAY_VERTICAL_POSITION – determine the position for the timestamp and location data within the photo, if this information is being added. The default position, if these parameters are omitted is Bottom Left.
-
Android Platform
On Android devices you can choose whether to use the device's native camera app or the camera features built into the Digitise Apps Client to take photos. The choice is determined by the setting specified in the CAMERA_TYPE option mentioned above. If you use the device's native camera app, features such as zoom and flash may be available to you.
iOS PlatformOn Apple iOS devices, you can choose whether to use the device's native camera app or the camera features built into the Digitise Apps Client to take photos. The choice is determined by the setting specified in the CAMERA_TYPE option mentioned above.
If you are using the device's default camera app, the user will need to tap Save Photograph to take a photograph or Cancel to return to the app without taking a photograph. Flash, zoom, focus lock and brightness controls may be accessible from the camera screen (in the standard manner) when taking a photo, depending upon the device.
If you are using the enhanced built-in camera, the advanced features of this camera include:
-
Switch between automatic and manual operation.
-
Set image resolution level.
-
Switch between telephoto and wide-angle lenses where this is supported by the device.
-
Set ISO level.
-
Adjust focal length and set focus lock.
-
Select flash mode for photography (Auto, On, Off).
-
Adjust White Balance and Tint levels.
-
Control exposure level and shutter speed.
-
Toggle display of a grid overlaying preview image to help in alignment of subjects.
-
Optical and digital zoom.
-
Hide/show camera controls so that they don't obscure the image.
-
Ability to save and restore camera settings – settings are automatically saved when you close the camera but there are also options allowing you to manually save and restore settings and reset the settings back to the shipping defaults.
These features are all accessible from the controls displayed when the camera is in use.
Windows Universal PlatformOn the Windows Universal Platform, the Digitise Apps Client directly accesses the device's camera. Tap the Camera icon to take a photograph or the device's Back button to return to the app without taking a photograph. If you take a photograph, you will be asked to confirm you want to keep it. Tap the "thumbs up" image to retain the photo or the "thumbs down" image to discard it and return to the camera to take the photo again.
Windows Desktop PlatformOn the Windows Desktop Platform, the Digitise Apps Client directly accesses the device's camera. Before taking your photo, you can choose the camera you want to use and the resolution at which to take the photo from a drop-down list on the toolbar. Then choose the Snap button to take a photograph or Back to return to the app without taking a photograph. When you take a photograph, you will be asked to confirm you want to keep the photo. Choose Yes to keep the photograph and return to the app, No to retake the photo or Cancel to return to the app without taking a photo.
-
-
If the user accepts the photograph then the image is placed into the specified field of the current record of the specified Data Source.
To display the photo on the current form, you need to have a Picture & Video Control on the form set for use with images and input mapped to the specified field. You will then need to call RefreshControls to update the control with your new image.
-
To save the photo, you MUST call UpdateCurrentRecord to save the record to the local database before moving to a different record.
-
The Data Source field can have a data type of image, binary or varbinary.
-
The photo will be saved in jpeg format.
-
Although you need a Data Source field in which to save the photo(s) you take, saving large data items directly in the database can make your app slower. For this reason, the Properties of the Data Source field allow you to opt to save photos to file instead, which is quicker for large objects. When you need to refer to the photo, e.g. within your Scripts or to create input and output mappings, you still refer to the Data Source field within the database and Digitise Apps keeps track of the file(s) used to store your photo(s) behind the scenes.
-
By default photos are restricted to 2.1 megapixels, to prevent potential memory issues due to handling large images. You can change the maximum size of a photo using the SetApplicationOption Method (see above).
See also: