FuseJS/CameraRoll Module (JS)
Allows adding images to- and fetching images from the system image gallery.
Fuse represents images as frozen JavaScript Image objects, consisting of a path, a filename, a width and a height. Once created or acquired, Images can be passed around to other APIs to use, fetch or alter their underlying data. All images are temporary "scratch images" until storage has been specified either through publishing to the CameraRoll or other.
Using this API on Android will request the WRITE_EXTERNAL_STORAGE
and READ_EXTERNAL_STORAGE
permissions.
Note: You need to add a package reference to
Fuse.CameraRoll
to use this API.
Examples
Requesting an image from the camera roll:
var cameraRoll = require("FuseJS/CameraRoll");
cameraRoll.getImage()
.then(function(image) {
// Will be called if the user successfully selected an image.
}, function(error) {
// Will be called if the user aborted the selection or if an error occurred.
});
Taking a picture with the camera and adding it to the camera roll:
var cameraRoll = require("FuseJS/CameraRoll");
var camera = require("FuseJS/Camera");
camera.takePicture(640, 480)
.then(function(image) {
return cameraRoll.publishImage(image);
})
.then(function() {
// Will be called if the image was successfully added to the camera roll.
}, function(error) {
// Will called if an error occurred.
});
Note: You also need to add a package reference to
Fuse.Camera
for the above example to work.
Location
- Namespace
- Fuse.CameraRoll
- Package
- Fuse.CameraRoll 2.9.1
Interface of CameraRoll
CameraRoll Constructor uno
checkPermissions() js
Checks if device has permissions to access the camera roll.
requestPermissions() js
Requests acccess to photo gallery
getImage() js
Starts an OS-specific image picker view (user-configurable on Android).
Inherited from NativeModule
AddMember(NativeMember) uno
Reset : EventHandler (object, EventArgs) ux
Inherited from Module
Dispose uno
Evaluate(Context, ModuleResult) uno
Evaluate(Context, string) : ModuleResult uno
Evaluated : EventHandler (object, EventArgs) ux
EvaluateExports(Context, string) : object uno
GetFile : FileSource uno
Returns the file source that will be watched by the Context for changes in Fuse preview. Override in subclasses and return correct file source to support live updates in Fuse preview.