FileManager: Reduce Image before upload

Can I catch an image file and reduce it before uploading it to the server?
When an user upload many images, speed up the upload and reduce server disk space usage.

Found this: $$(“files”).getUploader().attachEvent(“onBeforeFileAdd”, function(file)

Note: The original image is not touched. Like a new file or stream is used.

You can access the content of the file before uploading.

$$("files").getUploader().attachEvent("onBeforeFileAdd", function(record){
  record.file = some_processing(record.file);
});

record.file is a blob of data, content of the file. You can change it in a necessary way. Such changes will affect only the data which will be sent to a server side, and will not affect the original file