flybywire
flybywire

Reputation: 273492

generate "thumbnail" in html while keeping proportions

Is it possible to downsize an image in html while keeping proportions?

I know I can use height and width attribute of img tag, but I don't know the image size.

Please don't tell me to find out the image size on the server, or that the right way to do this is to generate thumbnails on the server side and that is saves bandwidth and improves page loading time.

I know what the ideal solution is. But I want quick and dirty...

Upvotes: 2

Views: 1922

Answers (3)

Anax
Anax

Reputation: 9372

Remember also that you can give a percentage of the original width / height as value as well, for instance:

<img src="my.jpg" width="50%" />

Upvotes: 0

Quentin
Quentin

Reputation: 943510

Yes. Just use height or width.

But quick and dirty is very dirty.

Upvotes: 4

Trick
Trick

Reputation: 3849

Quick and dirty: just set one of the attributes in img tag:

<img src="my.jpg" width="200" /> or <img src="my.jpg" height="200" />

Upvotes: 6

Related Questions