« Back to code index... | Contact me regarding this code...

Inline Image Demo

The following image (if viewed through Mozilla and FireFox) is stored within a JS variable. There is no second trip back to the server to get the image.

1

The following ColdFusion code was used to generate the JS string:

    <cffile action="READ" file="#ExpandPath('.\1.jpg')#" variable="thefile">

    <cfscript>
      for(i = 1; i LTE Len(thefile); i = i + 1)
      {
        character = Right("0" & FormatBaseN(Asc(Mid(thefile, i, 1)), 16), 2);
        WriteOutput("\u00" & character);
      }
  
    </cfscript&g;