String baseDirectory = getServletContext().getInitParameter("directory");
String noImageImage = getServletConfig().getInitParameter("noImageImage");
int width = getIntParameter(getServletConfig(), "width");
int height = getIntParameter(getServletConfig(), "height");
try {
IImage image = new AWTImage(PathResolver.resolve(baseDirectory+imageName, ImageServlet.class));
if(width!=0 || height != 0){
image.scale(width, height, true, true);
}
if(image.getWidth() > FLASH_PIXEL_HARD_LIMIT || image.getHeight() > FLASH_PIXEL_HARD_LIMIT){
image.scale(FLASH_PIXEL_HARD_LIMIT, FLASH_PIXEL_HARD_LIMIT, true, true);
}
image.streamTo(resp.getOutputStream());
} catch(Exception e){
IImage image = new AWTImage(PathResolver.resolve("com/itstherules/mediacentre"+noImageImage, ImageServlet.class));
image.streamTo(resp.getOutputStream());
}
}