cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to bind Image in Image tag through jsonmodel

Yogendra_Ahuja
Explorer
0 Kudos

Hi,

Im building a fiori mobile application that captures a image from mobile camera the image uri is set to image tag using jsonmodel binding. but after binding the image tag gets blanked.

Below is the code :

_onOpenCamera : function(oEvent){

var options = {

quality: 20,

destinationType:

Camera.DestinationType.FILE_URI,

sourceType: Camera.PictureSourceType.CAMERA,

encodingType: Camera.EncodingType.JPEG, mediaType: Camera.MediaType.PICTURE, allowEdit: true, correctOrientation: true,

saveToPhotoAlbum: true

}

var path = oEvent.getSource().getBindingContext().getPath()

navigator.camera.getPicture(function cameraSuccess(imageUri) {

//vModel is a JSONModel already set to the view.

vModel.setProperty(path+"/defaultImgPath",imageUri);

}, function cameraError(error) { console.debug("Unable to obtain picture: " + error, "app"); }, options);

}

<Image src="{defaultImgPath}" mode="Image" height="50px" width="50px" visible="true" press="_onOpenCamera" densityAware="false"/>

Ivan-Mirisola
Product and Topic Expert
Product and Topic Expert
0 Kudos

Have you seen this question and its answers?

Have you tried debugging your code to see if the console log throws any errors?

Accepted Solutions (0)

Answers (0)