loadImage

loadImage(url, allowCrossOrigin, request)Promise.<Image>|undefined

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.
Name Type Default Description
url String The source URL of the image.
allowCrossOrigin Boolean true optional 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.
request Request optional The request object. Intended for internal use only.
Returns:
a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority.
Example:
// load a single image asynchronously
Cesium.loadImage('some/image/url.png').then(function(image) {
    // use the loaded image
}).otherwise(function(error) {
    // 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: