11 thoughts

  1. @Randy,
    The CFContent tag has a Variable attribute that allows you to pass in a binary variable:
    <cfcontent type="image/jpeg" variable="#qData.blob#" />
    I feel like the advent of CFContent got rid of many of

  2. I’m doing this with cfcontent all the time, what’s the benefit of "streaming" images instead? With cfcontent you block one of the listeners ("simultanious requests") while the image is being transferred to the client, is this perhaps different with the streaming example?

  3. If I had the Maximum number of simultaneous requests set to 8 on my server and my site was streaming 8 images to users with a dialup connection that would clog the machine right? That problem wouldn’t exist using the file system.
    -Randy

  4. @Randy,
    Whether you are writing to the Response object or using the CFContent tag, I *assume* that it still keeps the single thread busy with the binary data transfer. After all, something still needs to be flushing the response to the client.

  5. I wonder if this would fix (and I should test it) the bug with serving up images that are virgin – ie – make from scratch with cfimage (as opposed ot reading in a real file). I know Jason Delmore had posted a fix for that a while ago.

  6. @Ray,
    I think the problem there is that on a CFImage-created binary, there is no "file type" until the image is saved. Therefore, I think there are problems streaming the underlying BLOB data because it has no particular encoding?? I am o

  7. The difference between the code in the tech note and cfcontent is that with cfcontent the server sends Connection:close to the client, and with the code in the tech note, it sends Content-Length. I determined this with the HTTP-Headers plugin for firefox. I’m not sure I understand the difference, or why I might use one and not the other, but there it is.
    I tested this with a very large image, and both techniques loaded the image in the same amount of time.
    One of the servers I have access to has sandbox security turned on. cfcontent is not allowed, but cffile is allowed, and the code in the technote works on that server. So there’s one advantage. If you’re allowed to use cffile but not cfcontent, this is a workaround.

  8. @Chris,
    Good point re: security concerns. As for the content length, you can add that using CFheader:
    <cfheader name="content-length" value="#ArrayLen( binaryData )#" />
    <cfcontent …. />

Leave a Reply