This guide explains how to deal with files and images.
Images can be retrieved from a file or from a URL to be downloaded as a file. It is possible to use the File object to get an image from a file and specify a target file to save an image.
Following objects support working with the File object:
The image property supports assigning strings which look up for certain locations with the file name. The new imageFile property is useful to get and set specific files for the UI Image object.
When the image property is a URL, first the image in the URL is saved to a file in the Downloaded Images directory in applicationTemporaryData. This behavior changes when UI Image is using cached images, then the image will be saved in a different location, in the ImageCache directory of applicationCacheDirectory.
The same things for SMF.UI.Image applies for the SMF.UI.ImageButton too, for every …image property, an …ImageFile property is defined. As the ImageButton does not have caching for the downloaded images, it never saves the downloaded images under applicationCacheDirectory.
inactiveImage → inactiveImageFile
defaultImage → defaultImageFile
highlightedImage → highlightedImageFile
When an Image object is created, the constructor requires the URL of the image. Instead of the imageURI property, a file reference can be also set using the file property in the constructor.
After creating an image, the file property can be retrieved once the image has been successfully loaded.
The captured photos with the camera will be saved under the “Camera” sub directory of applicationTemporaryData.
Image Button example
Assigning a file to an ImageButton as below :
Bitmap Object example
Assigning a file to an Bitmap Object as below
For detailed camera guide please check Camera Usage