0

How to use JavaScript compress images to limit file size and resize to limit dimension before upload to server.

Michail Michailidis
  • 11,792
  • 6
  • 63
  • 106
  • Draw it on the `canvas` first, you can resize it by this step, then use [canvas.toDataURL](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL) to get the `src` and set it on image, you can notice that it accepts 2nd parameter which is related to quality. – fuyushimoya Aug 04 '15 at 04:03

1 Answers1

0

In HTML 5 you can resize images client-side using the canvas element. You can also take the new data and send it to a server. See this tutorial

Pindo
  • 1,585
  • 5
  • 16
  • 32