-2

Let's say I have an image URL (for example: http://theartmad.com/wp-content/uploads/2015/04/Smile-3.jpg) and I need to show it on my web page, but I do not need it's original big size, let say I need only 100px width image. Set max-width: 100px in CSS doesn't helps, because we still loading 222KB, the whole original image size, is there a possibility to show this image on my page compressed to 100px width size without server compression, only on browser? If I need to show many images, something like 20 at once, do it works quick or too slow?

Is there some staff that I can read to understand it better?

Pumych
  • 1,187
  • 3
  • 16
  • 27
  • 1
    You seem to be talking about [responsive images](http://alistapart.com/article/responsive-images-in-practice), which is a problem that is still being solved in many different ways. – Blazemonger Dec 04 '15 at 16:44
  • Do you want to avoid downloading the whole 222kb or do you need 100px "thumbnails". The first one is not possible client-side only, the latter, on the other side, is. – deamentiaemundi Dec 04 '15 at 16:46
  • I want to avoid loading huge image to page, in window's Paint program, if I resize the image and save it, it will be smaller in KB size too. – Pumych Dec 04 '15 at 16:56
  • A simple way to handle this is to use an image hosting service such as the imgur api. Depending on your hit rates and usages, you need to see the terms and conditions. There are many services out there that can serve different size images such as flickr, 500px, etc. See the thumbnail section for example: https://api.imgur.com/models/image – Radio Dec 04 '15 at 17:00
  • Possible duplicate of [How to compress an image via Javascript in the browser?](http://stackoverflow.com/questions/14672746/how-to-compress-an-image-via-javascript-in-the-browser) – Pumych Sep 29 '16 at 04:55

1 Answers1

0

Not without some kind of proxy to host the compressed image. In short, you can't do client-side compression without pulling down the original file which needs to be compressed.

Ryan Nigro
  • 3,751
  • 2
  • 15
  • 23
  • So you are talking about **uploading** large pictures from the client to the server? If that is the case you might think about clarifying your question. – deamentiaemundi Dec 04 '15 at 20:44