FileUpload.getBase64Image

Syntax

getBase64Image(callback: PP.Delegate);

Parameters

callback. Loading event handler. Available argument: Message - base64-view of loaded image.

Description

The getBase64Image method loads an image.

Example

To execute the example the FileUpload component named fileUpload must be available (see FileUpload constructor). Add image in the file loader:

Next load specified image and get its base64-view:

// Load image
fileUpload.getBase64Image(function(sender, args) {
    if(args) {
        var base64Image = args.Message;
        console.log("Loaded image:");
        console.log(base64Image);
    }
});

As a result of executing the example the browser console displays the base64-view of loaded image:

Loaded image:

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA+YAAAMBCAIAAADtQzlKAAAAAXNSR…

MABCAAAQhAAAIQgACSHR+AAAQgAAEIQAACEIDApgn8/wHwLnNiHwraeAAAAABJRU5ErkJggg==

See also:

FileUpload