Upload - camera : how to set pixels dimension (width & eight) using camera

Hi,

THIS IS MY QUESTION: how can I set the resolution of an image file before it is generated by the Upload / Receiver component in a path on the server, even if the component automatically calls the mobile phone camera ???

thanks in advance for support, someone can help me please?

this is the situation
i use your Upload.class(java) and receiver TO MAKE files from Camera mobile Phones component,
but the image is written(mkdirs) on server side in defined class path,

the file is produced as .jpg BUT the pixels resolution is too large (due to the megapixel of the new smartphone / mobile phones) at least 3000px with and 4000px height, average size between each file 3/5Mbyte

i wrote a class to resize images file and work fine, but I can’t integrate it because the component Upload writes the file into the path on server BEFORE i can call Java Resize class, **and so I can’t get the advantage of a faster webapp UI:

  1. to upload faster (smaller size, not 3MByte but 150KByte for example)
  2. to show image into image obj on UI session**
    @Override
	public OutputStream receiveUpload(String filename, String mimeType) {
		FileOutputStream fos = null;
		try {

			String newFileName = filename;			
			File file = new File(path, newFileName);
			new File(path).mkdirs();
			file.createNewFile();
			fos = new FileOutputStream(file);

			String relativePath = file.getAbsolutePath().replace(path, "");
			if (relativePath.startsWith(System.getProperty("file.separator"))) {
				relativePath = relativePath.substring(1);
			}

I attach the image UI in layout than the file was created and Uploaded into path on server…

upload = new DocUpload(getRefDoc()) {
...
	@Override
	protected void newFileUploaded(File file) throws IOException {
					String newFileName = "nameFile.jpg";
					File newFile = new FileEncoded(file.getParent(), newFileName);
					file.renameTo(newFile);
					
			// Resizing Image too big (.jpg file)
			//		JImgResizer resizing = new JImgResizer(newFile);
			//		File fileResized = resizing.resizeOne(newFile);
					
					addFile(fileResized);
					
					image.setSource(new FileResource(fileResized)); 
					image.setWidth("100%");			
.......					
				}
			};
			upload.setImmediate(true);
.....
			image = new Image();
			.....

Hi,
update this post… this is my current procedure:

  1. the Vaadin Upload component (with respective Receiver) open the camera of the mobile phone that takes the picture and is saved on the server side (from the client browser session opened by the mobile device)

  2. my class converts the file by reducing it in size and with a size of 10/15 less (example 3.2MByte => 150kb) .jpg MiMeType

  3. delete the original file in the path and load the resized file in the UI of the mobile client side browser session

QUESTION:
How can I anticipate the conversion with your component Upload or even save the file with a desired size and pixels? (smaller) so as to speed up the upload of image files to the server and then to the gUI of the mobile client?

thanks for the help, so I should have explained better.