loadImage

loadImage

Asynchronously loads the given image URL. Returns a promise that will resolve to an Image once loaded, or reject if the image failed to load.

Parameters:
Name Type Argument Default Description
url String | Promise The source of the image, or a promise for the URL.
allowCrossOrigin Boolean <optional>
true Whether to request the image using Cross-Origin Resource Sharing (CORS). CORS is only actually used if the image URL is actually cross-origin. Data URIs are never requested using CORS.
Returns:
Promise a promise that will resolve to the requested data when loaded.
Example
// load a single image asynchronously
Cesium.loadImage('some/image/url.png').then(function(image) {
    // use the loaded image
}, function() {
    // an error occurred
});

// load several images in parallel
when.all([loadImage('image1.png'), loadImage('image2.png')]).then(function(images) {
    // images is an array containing all the loaded images
});
See:
Source: