Intro
In Aquro, we have several features you can take advantage of that relate to the camera of the devices running your app. To use any of the features highlighted in this article you will need to use the Aquro Preview app.
The following Visual Coding blocks can be used to utilize the device camera, manage photos, and handle other images in your app:
Device.Cache.ImgInit
Waits for the image cache to initiate
Parameters:
None
Return values:
Error (Value) - Error if something went wrong
Outlets:
Done - Called when the image cache is ready
Timeout - Called if the image cache occurred a timeout (1 second)
Error - Called if something went wrong
Device.Camera.GetPhotoData
Lets the user capture a photo and the return the DataURL of the new photo.
Parameters:
Quality (Value) - The percentage of quality of the image (1 - 100) where 100 is 100% quality, no compression made
MaxWidth (Value) - The max width of the image (MaxHeight have to be set as well)
MaxHeight (Value) - The max height of the image (MaxWidth have to be set as well)
Return values:
ImageData (Value) - The DataURL of the new photo
Error (Value) - Error if something went wrong
Outlets:
Done - Called if a new photo was captured
Error - Called if something went wrong
Device.Camera.GetPhotoFile
Lets the user capture a photo and the return the file path to the new photo
Parameters:
Quality (Value) - The percentage of quality of the image (1 - 100) where 100 is 100% quality, no compression made
MaxWidth (Value) - The max width of the image (MaxHeight have to be set as well)
MaxHeight (Value) - The max height of the image (MaxWidth have to be set as well)
Return values:
FilePath (Value) - The file path to the new photo
Error (Value) - Error if something went wrong
Outlets:
Done - Called if a new photo was captured
Error - Called if something went wrong
Device.ImagePicker.GetOne
Let the user pick on image from the image gallery
Parameters:
MaxWidth (Value) - The max width of the image
Quality (Value) - The quality of the image returned (0 - 100)
Return values:
ImagePath (Value) - The file path to the photo
ErrorMessage (Value) - Error if something went wrong
Outlets:
Done - Called if a new photo was captured
Failed - Called if something went wrong
Device.ImagePicker.GetMany
Let the user pick up to 10 images from the image gallery
Parameters:
MaxWidth (Value) - The max width of the image
Quality (Value) - The quality of the image returned (0 - 100)
Return values:
ImagePath1 (Value) - File path to the photo
ImagePath2 (Value) - File path to the photo
ImagePath3 (Value) - File path to the photo
ImagePath4 (Value) - File path to the photo
ImagePath5 (Value) - File path to the photo
ImagePath6 (Value) - File path to the photo
ImagePath7 (Value) - File path to the photo
ImagePath8 (Value) - File path to the photo
ImagePath9 (Value) - File path to the photo
ImagePath10 (Value) - File path to the photo
ErrorMessage (Value) - Error if something went wrong
Outlets:
Done - Called if a new photo was captured
Failed - Called if something went wrong
You can always use your own custom JavaScript code to customize the way you like to use these device features.
For the image cache Aquro is using the imagechache.js library.
More info: https://github.com/chrisben/imgcache.js/
For capturing photos with the device camera Aquro is using the cordova-plugin-camera plugin plugin.
More info: https://github.com/apache/cordova-plugin-camera
For picking images from the photo library Aquro is using the cordova-plugin-image-picker plugin
More info: https://github.com/wymsee/cordova-imagePicker