There is an image selected using input type="file"
. How to resize the image on the client before uploading it to the server?
|
2 answers
This is done like this . Note that for such manipulations the browser must support HTML5.
|
If you use the FileAPI library, it will look like this:
<input id="choose" type="file" name="files[]" /> <script> FileAPI.event.on(choose, 'change', function (evt){ FileAPI.upload({ url: '...', files: evt.target, imageTransform: { maxWidth: 800, maxHeight: 600 }, complete: function (err, result){ } }); }); </script>
|