Greg's Blog

helping me remember what I figure out

Embedded Image

| Comments

A client recently decided to start storing all of their images in a database and usually we would point the image source to a cfm page, where we’d do something like this: [code] request.uploadedPic = application.staffManager.getStaffImage(session.user.getId()); context = getPageContext(); context.setFlushOutput(false); response = context.getResponse().getResponse(); out = response.getOutputStream(); response.setContentType(“image/jpeg”); response.setContentLength(arrayLen(request.uploadedPic[‘staffPhoto’][1])); out.write(request.uploadedPic[‘staffPhoto’][1]); out.flush(); response.reset(); out.close(); [/code] Which worked nicely until I read about some performance issues with http calls and the cfdocument tag. Zac (yes his name pops up a lot in this blog), put me onto directly embedding the image into the source, like such: [code]Embedded Image[/code] No need to make a http call to display the image anymore.

Comments