public static Uri resizeAndImportImage(Context context,String sessionId,Uri uri,String mimeType) throws IOException {
  String imagePath=uri.getPath();
  String targetPath="/" + sessionId + "/upload/"+ imagePath;
  targetPath=createUniqueFilename(targetPath);
  int defaultImageWidth=600;
  Bitmap bmp=getThumbnailFile(context,uri,defaultImageWidth);
  File file=new File(targetPath);
  FileOutputStream out=new FileOutputStream(file);
  if (imagePath.endsWith(".png") || (mimeType != null && mimeType.contains("png")))   bmp.compress(Bitmap.CompressFormat.PNG,100,out);
 else   bmp.compress(Bitmap.CompressFormat.JPEG,90,out);
  out.flush();
  out.close();
  bmp.recycle();
  return vfsUri(targetPath);
}

public static Uri resizeAndImportImage ( Context context , String sessionId , Uri uri , String mimeType ) throws IOException { String imagePath = uri . getPath ( ) ; String targetPath = "/" + sessionId + "/upload/" + imagePath ; targetPath = createUniqueFilename ( targetPath ) ; int defaultImageWidth = 600 ; Bitmap bmp = getThumbnailFile ( context , uri , defaultImageWidth ) ; File file = new File ( targetPath ) ; FileOutputStream out = new FileOutputStream ( file ) ; if ( imagePath . endsWith ( ".png" ) || ( mimeType != null && mimeType . contains ( "png" ) ) ) bmp . compress ( Bitmap . CompressFormat . PNG , 100 , out ) ; else bmp . compress ( Bitmap . CompressFormat . JPEG , 90 , out ) ; out . flush ( ) ; out . close ( ) ; bmp . recycle ( ) ; return vfsUri ( targetPath ) ; }
resize an image to an efficient size for sending via otrdata , then copy that resized version into vfs . all imported content is stored under / session_name / the original full path is retained to facilitate browsing the session content can be deleted when the session is over
