-
-
Save ivanionut/ce6196b47c08bcd37c8d to your computer and use it in GitHub Desktop.
CFML: Create Data URI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <cfscript> | |
| function data_uri(fullFilePath, mimeType='image/*') { | |
| var contents = fileReadBinary(fullFilePath); | |
| var base64contents = toBase64(contents); | |
| var returnString = "data:" & mimeType & ";base64," & base64contents; | |
| return returnString; | |
| } | |
| </cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment