try {
ODocument doc=FileService.getById(id);
if (doc==null) return notFound(id + " file was not found");
String filename=(String)doc.field("fileName");
Context ctx=Http.Context.current.get();
Boolean download = BooleanUtils.toBoolean(ctx.request().getQueryString(QUERY_STRING_FIELD_DOWNLOAD));
String resize = ctx.request().getQueryString(QUERY_STRING_FIELD_RESIZE);
boolean resizeIsEmpty=StringUtils.isEmpty(resize);
Integer sizeId = Ints.tryParse(ctx.request().getQueryString(QUERY_STRING_FIELD_RESIZE_ID)+"");
byte[] output;
if (sizeId!=null){
output = FileService.getResizedPicture(id, sizeId);
String[] fileName=((String)doc.field("fileName")).split("\\.");