private static byte[] getResizedPicture(String fileAssetName, ImageDimensions dimensions) throws SqlInjectionException, DocumentIsNotAnImageException, DocumentIsNotAFileException, IOException, InvalidSizePatternException {
//load the document
FileAssetDao dao = FileAssetDao.getInstance();
ODocument asset=dao.getByName(fileAssetName);
if (asset==null) return null;
if (!StorageUtils.docIsAnImage(asset)) throw new DocumentIsNotAnImageException();
//check if the image has been previously resized
String sizePattern= dimensions.toString();
try{
byte[] resizedImage = dao.getStoredResizedPicture( asset, sizePattern);