ImageLoaderUrlMode Enumeration

Summary

Specifies the mode by which the Image or XML will be loaded.

Syntax

JavaScript Syntax
lt.ImageLoaderUrlMode = { 
	ImageUrl: 0, 
	AjaxDataUrl: 1, 
	AjaxXml: 2 
} 
TypeScript Syntax
lt.ImageLoaderUrlMode = { 
	ImageUrl: 0, 
	AjaxDataUrl: 1, 
	AjaxXml: 2 
} 

Members

0 ImageUrl

(0)The typical way to load an HTML Image Element, by setting the Url to the src attribute of the element.

1 AjaxDataUrl

(1)Use an XMLHttpRequest to load the image or SVG as binary data.

2 AjaxXml

(2)Use an XMLHttpRequest to load the image or SVG directly.

Remarks

ImageLoaderUrlMode is for use with the UrlMode property. The chosen enum value dictates how the Url will be loaded to create the resulting Element.

There are three distinct ways an image can be loaded:

ImageUrl AjaxDataUrl AjaxXml
Description ImageUrl loads an image the way most people would intend - by creating a new HTML Image Element and setting the src attribute of that element to the Url property. This method works best for loading web-safe images quickly. AjaxDataUrl loads an image using XMLHttpRequest, and thus supports appending headers and additional data (if POST) to the request. These additional options are available through a ImageLoaderAjaxOptions object on AjaxOptions. The data is always requested in a binary format, so additional time is taken to convert the data to a viewable form. AjaxXml loads XML using XMLHttpRequest, meaning it also supports the options from AjaxOptions. This method is the only one that will load an SVG in its full format, instead of as an SVG-as-IMG (and HTML Image Element holding an SVG). As the name implies, arbitrary XML can also be loaded, though normal web-safe image filetypes cannot.
For Images ImageUrl is the best option for loading web-safe image filetypes. This method works in every browser and is fastest. AjaxDataUrl will request the image as binary data, which in most cases will be slower as the data must be converted to a Blob type and reloaded. This method does, however, hold the advantage of allowing AJAX customization in the form of headers and data via ImageLoaderAjaxOptions in AjaxOptions. AjaxXml will fail for normal web-safe images, since it expects XML. However, should the Url point to a server that can return an SVG element as a wrapper to the image as its only child, ImageLoader will be able to load and return only that image as an HTML Image Element. In this case, the image inside the SVG can be either embedded or linked.
For SVG ImageUrl loads an SVG inside of an HTML Image Element. For browser security reasons, any images inside the SVG must not be linked images. The SVG will render fast, but memory consumption may be high and native SVG functions (such as text selection) are lost. AjaxDataUrl also loads the SVG inside of an HTML Image Element, using AJAX. The data is returned as binary, so additional processing time is required. As with ImageUrl, any images inside the SVG must not be linked images. The SVG will render fast, but memory consumption may be high and native SVG functions (such as text selection) are lost. AjaxXml loads the SVG in its native XML format, using AJAX. This format works in all browsers, but rendering may be slow and the DOM may become congested. The SVG will have all native functionality, such as attribute editing and text selection.
For XML ImageUrl will fail when trying to load XML. AjaxDataUrl will fail when trying to load XML. AjaxXml allows XML to be retrieved from an endpoint via AJAX, though with the same caveats as loading an SVG - slow rendering and a much larger DOM size.

If the Url to be loaded is a data url, it will always be loaded as ImageLoaderUrlMode.ImageUrl.

Example

For an example, refer to ImageLoader.

Requirements

Target Platforms

See Also

Reference

Leadtools Namespace

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.

Leadtools Assembly