Optimizing images from another source

时间:2015-09-01 21:49:14

标签: javascript html optimization

On my small webapp, I'm pulling lots of image urls in order to create a large gallery. However, most of these photos have very large resolutions and this leads to a very slow webpage. Are there ways for me to optimize/lower the resolution on the photos?

1 个答案:

答案 0 :(得分:1)

There are basically two ways to do this:

  1. Let the user upload the images to your server, which would then compress them before storing. How you do this depends on the technologies used on your backend. The only disadvantage is that the user will have to upload the full size image to your server, but that's not related to the problem you're trying to solve.

  2. Compress the images using JavaScript in the browser. This relies on several HTML5 technologies meaning it may not be supported in all the major browsers, especially older versions. If you're still determined to use this approach, this library may help.

相关问题