ImageWritebase64()
Converts the image to Base64 before writing
Usage
STRING = ImageWritebase64(
name,
destination,
format,
inhtmlformat,
overwrite,
quality
)
Argument | Summary |
---|---|
name | the image object derived from ImageNew() or ImageRead() |
destination | the file path to where the image will be written; optional |
format | flag to control where the destination file is overwritten if using the file |
inhtmlformat | the format of the output; gif, png, jpg [optional] |
overwrite | whether or not to include the HTML format data for using inline with HTML img tags [optional] |
quality | quality of the image if its a jpg; default 0.75 [optional] |
Calling
Supports named-parameter calling allowing you to use the function like:
ImageWritebase64( name=?, destination=?, format=?, inhtmlformat=?, overwrite=?, quality=? );
Supports passing parameters as a structure using ArgumentCollection:
ImageWritebase64( ArgumentCollection={ name : ?, destination : ?, format : ?, inhtmlformat : ?, overwrite : ?, quality : ? } );
Extra
<cfset im = ImageRead( ExpandPath("/image/mylogo.jpg") )> <cfset b = ImageWriteBase64( name=im, format="jpg", inhtmlformat=true )> <img src="<cfoutput>#b#</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