Class: GrabbaUtil

GrabbaUtil

Access this class via grabba.util

Constructor

new GrabbaUtil()

Access Grabba utilities via grabba.util

Methods

convertJpegToBase64(onSuccess, onError, imageData, offset)

Convert jpeg or JPEG2000 image data to a base64 string with a "data:image/png;base64," header, ready for presentation.
Parameters:
Name Type Description
onSuccess function Called on success with the following parameters:
{String} png image data encoded as a base64 String with "data:image/png;base64," header, ready for use as image source.
onError function Called on error with the following parameters:
{String} error description.
imageData Array.<int> Image data.
offset int Offset into the image data when the image begins.
Example
//Convert a JPEG or JPEG2000 image to Base64
ons.grabba.util.convertJpegToBase64(function(imageBase64) {
    document.getElementById("photo").src = imageBase64;
}, function(errorString) {
    alert('on error ' + errorString);
}, data, offset);

integerArrayToHexString(array)

Convert an integer array to base 16 hex string.
Parameters:
Name Type Description
array Array.<int> of integers to convert.
Example
//Generate a hex string from returned proxcard data
var hexString = ons.grabba.util.integerArrayToHexString(proxcard.data);