CameraLib

This library provides an API for taking pictures and for choosing images from the image library of the system.

Record

CameraOption is the option to take pictures.

quality int?
The quality of the saved image. The value ranges from 0 to 100. 100 is typically full resolution with no loss from file compression. The default value is 50.
destinationType int?
Chooses the format of the return value. The following types are available:
  • DESTINATION_TYPE_DATA_URL
  • DESTINATION_TYPE_FILE_URI (default)
  • DESTINATION_TYPE_NATIVE_URI
sourceType int?
Sets the source of the picture. The following values are available:
  • PICTURESOURCE_TYPE_PHOTOLIBRARY
  • PICTURESOURCE_TYPE_CAMERA (default)
  • PICTURESOURCE_TYPE_SAVEDPHOTOALBUM
allowEdit boolean?
Sets if simple editing is allowed before selection.
encodingType int?
Determines the encoding type of the returned image file. The following values are available:
  • ENCODING_TYPE_JPEG (default)
  • ENCODING_TYPE_PNG
targetWidth int?
The width of the target picture in pixel. The aspect ratio remains constant.
targetHeight int?
The height of the target picture in pixel. The aspect ratio remains constant.
mediaType int?
Sets the type of media. It works only when PictureSourceType is PHOTOLIBRARY or SAVEDPHOTOALBUM. The following values are available:
  • MEDIA_TYPE_PICTURE (default)
  • MEDIA_TYPE_VIDEO
  • MEDIA_TYPE_ALLMEDIA
correctOrientation boolean?
Specifies if rotating the image is needed.
saveToPhotoAlbum boolean?
Specifies if the image should be saved to album as well.
cameraDirection int?
Chooses the camera to use. The following values are available:
  • DIRECTION_BACK
  • DIRECTION_FRONT
Functions
getPicture (onSuccess camaraSuccess in, onError CordovaErrorHandler in, options CameraOption in)
Takes a photo with the camera, or retrieves an image from the image gallery of the device. The image is passed to the success callback as a base64-encoded string, or as the URI for the image file.
onSuccess
The success callback of delegate camaraSuccess, with the image data string or URI passed in.
Delegate CamaraSuccess(picture String in) end
onError
The error callback function.
options
A cameraOption record to specify the options for taking pictures.
cleanup (onSuccess CordovaSuccessHandler in, onError CordovaErrorHandler in)
Deletes intermediate photos taken by the camera from the temporary storage.
onSuccess
The success callback.
onError
The error callback function.