Hello guys,
Needed to do this for a project my team is maintaining, but I could only find the solution for ColdFusion, which looks like this:
JavaImport = structNew();
JavaImport.io = structNew();
JavaImport.io.File = CreateObject('java', 'java.io.File');
JavaxImport = StructNew();
JavaxImport.imageio = StructNew();
JavaxImport.imageio.ImageIO = CreateObject('java', 'javax.imageio.ImageIO');
imageBuffer = JavaxImport.imageio.ImageIO.read(JavaImport.io.File.Init(imagePath));
response = getPageContext().getFusionContext().getResponse();
response.setHeader('Content-Type', 'image/png');
response.setHeader('Cache-Control', 'max-age=604800, public');
JavaxImport.imageio.ImageIO.write(imageBuffer, "png", response.getResponse().getOutputStream() );
After consulting Railo documentation on GetPageContext method, we've come to the following result:
JavaImport = structNew();
JavaImport.io = structNew();
JavaImport.io.File = CreateObject('java', 'java.io.File');
JavaxImport = StructNew();
JavaxImport.imageio = StructNew();
JavaxImport.imageio.ImageIO = CreateObject('java', 'javax.imageio.ImageIO');
imageBuffer = JavaxImport.imageio.ImageIO.read(JavaImport.io.File.Init(imagePath));
response = getPageContext();
response.setHeader('Content-Type', 'image/png');
response.setHeader('Cache-Control', 'max-age=604800, public');
JavaxImport.imageio.ImageIO.write(imageBuffer, "png", response.getResponseStream() );
How it will be useful to you as well....
Hello guys,
Needed to do this...
Read More