cancel
Showing results for 
Search instead for 
Did you mean: 

Image display from camera

Former Member
0 Kudos

Able to capture image from the camera using SUP 2.1.3.  Call to the method is: customGetPictureDataFromCamera();

also able to capture the Base64 raw data of the image. What I'm trying to do now is display this image just taken, on the same page in workflow.  Tried to use "Image" from the Controls section.  Even tried to use HtmlView to display the image using Canvas.  But not sure why I am unable to display the image.

When using the "Image", this is what I tried to do, assuming that the "Key" of Image is "formkey_imageView".  In the "customBeforeShowScreen",

//display image taken on image view

                    var imageElement = document.getElementById('formkey_imageView');

                    imageElement.src = notificationObject.imageRawData;

if using HtmlView, in the "Default" field: <canvas id="formkey_image_canvas"></canvas>.  And in the "customBeforeShowScreen":

var canvas = document.getElementById("formkey_image_canvas");

                    var ctx = canvas.getContext('2d');

                    var theImage = new Image();

                    theImage.src = notificationObject.imageRawData;

                    ctx.drawImage(theImage,0,0);

                    var mydataURL = canvas.toDataURL('image/png');

NOTE: the notificationObject.imageRawData does have the Base64 decoded image.  Thanks for any help.

Accepted Solutions (0)

Answers (1)

Answers (1)

Dan_vL
Product and Topic Expert
Product and Topic Expert
0 Kudos

I believe the Expense Tracking sample demonstrates this in the section titled Accessing the Camera.

Expense Tracking Sample https://cw.sdn.sap.com/cw/docs/DOC-148193

Hope that helps,

Dan van Leeuwen