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.

  // This is ColdFusion
  tempFile = "ram:///myImage.txt";

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

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

  myfile = FileRead(tempFile);

<div id="image">
   <img :src="captcha">

  // this is JavaScript

  data = { 'captcha' : <cfoutput>'#myfile#'</cfoutput> };

  new Vue({
      el: '#image',
      data : data

Can this process be improved?


1 Answer 1


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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.