Creating CAPTCHA in ColdFusion then showing image in Vue.js I am trying to create a CAPTCHA image on ColdFusion. ColdFusion will be producing REST services and hence will have to push the image via JSON. I want the image to be self contained. I don't want to expose any of the servers paths, so I am going to encode the image and push that via JSON. Last but not least, Vue.js will be used to show the image on the page.

Note: I have omitted the AJAX part for clarity.

&lt;cfscript&gt;
  // This is ColdFusion
  tempFile = "ram:///myImage.txt";

  myImage = ImageCreateCaptcha(100, 300, "Blackcat", "high");

  ImageWriteBase64(myImage, tempFile, "png",true, true);

  myfile = FileRead(tempFile);
  FileDelete(tempFile);
&lt;/cfscript&gt;



&lt;div id="image"&gt;
   &lt;img :src="captcha"&gt;
&lt;/div&gt;


&lt;script&gt;
  // this is JavaScript

  data = { 'captcha' : &lt;cfoutput&gt;'#myfile#'&lt;/cfoutput&gt; };

  new Vue({
      el: '#image',
      data : data
      });
&lt;/script&gt;


Can this process be improved?
Be careful with storing intermediate data to disk, including RAM disk. Because it is shared by the whole server, it is even worse than a global variable! The data you write may not be the data you read.