Upload files from the client vs server

Hi, in my application users are currently uploading photos directly to Amazon with Slingshot, the problem is that some go up very large files or take heavy photos with their phones, I don’t know how to change the weight of the photos before sending them. Previously I used GraphicsMagick and it was much easier to, I should do now, spend back to the server?

I actually just revisited this today. If you want to keep things all on the client, check out this repo for some ideas about how to implement into your code. Of course, you could pass the file to the server and handle it there, but you’d still be dealing with bandwidth issues.

In a nutshell, take your file input, send it through FileReader, draw it to a canvas element, then run a .toDataURL on your canvas with a lower quality setting. You can pass the result to an uploader with base64 encoding.

1 Like