0 Replies Latest reply on Jun 21, 2007 4:02 PM by Giri_sayee

    Displaying Byte Array images in coldfusion

    Giri_sayee
      This has been driving me crazy for a couple of days now.I have a Java class that returns pictures stored in a DB as a Byte Array.
      I am able to display the image but that is all i am able to do - I want to display the image name, description etc in a HTML before i display the actual image but i can't seem to find a way to do that.

      I tried using CFcontent as well and that did not help either.This is what i am currently doing - and all that displays on the screen is the picture and all content before the picture is nowhere to be seen.

      Picture Name: #variables.picName#
      Picture Description:#variables.picDescription#

      <cfscript>
      context = getPageContext();
      response = context.getResponse().getResponse();
      out = response.getOutputStream();
      response.setContentType("image/jpeg");
      response.setContentLength(arrayLen(session.picture));

      out.write(session.picture);
      out.flush();
      out.close();
      </cfscript>

      Any help will be greatly appreciated.