Creates a dataURI for use within HTML IMG/CSS/Javascript tags


STRING = ToDatauri( data, mimetype )
Argument Summary
data the binary or string object to encode to base64
mimetype the mime-type of the object


Supports named-parameter calling allowing you to use the function like:


Supports passing parameters as a structure using ArgumentCollection:

ToDatauri( ArgumentCollection={
   data : ?, 
   mimetype : ?
} );


<cfset im = ImageRead( ExpandPath("/image/mylogo.jpg") )>
<img src="<cfoutput>#ToDataURI( im, "image/jpg" )#</cfoutput>" />

The data URI scheme is a URI scheme that provides a way to include data in-line in web pages as if they were external resources. HTTP request and header traffic is not required for embedded data, so data URIs consume less bandwidth whenever the overhead of encoding the inline content as a data URI is smaller than the HTTP overhead. For example, the required base64 encoding for an image 600 bytes long would be 800 bytes, so if an HTTP request required more than 200 bytes of overhead, the data URI would be more efficient. More information on the DataURI