BufferedImage image = null;
ByteArrayOutputStream baos = null;
ByteArrayInputStream bais = null;
InputStreamInfo info = null;
ImageItem imgItem = (ImageItem) item;
try {
image = javax.imageio.ImageIO.read(item.getFile());
//Raz - modify this to send out the filename in an overloaded
//function of getScaledImageAndRotated
//in com.pegaa.uploader.tools.ImageFuncs
File rtmpf = item.getFile();
String rfilename = rtmpf.getName();
String rext = rfilename.substring(rfilename.lastIndexOf('.') + 1, rfilename.length());
image = getScaledImageAndRotated(image, imgItem.getRotationStatus(), rext);
baos = ImageFuncs.createImageOutputStream(image, rext);
byte[] resultImageAsRawBytes = baos.toByteArray();
bais = new ByteArrayInputStream(resultImageAsRawBytes, 0, resultImageAsRawBytes.length);