-3

Possible Duplicate:
how to create proportional image height/width

The height should be adjusted proportional so that the resulting thumbnail is not distorted. But as far as I know there is no such attribute like

<IMG SRC=...... WIDTH=70 HEIGHT="Adjust proportional to Width"> 

PHP or css..any one pls help

Community
  • 1
  • 1
user1753971
  • 81
  • 1
  • 8

2 Answers2

2

You could just add the width attribute in CSS instead...
Example: http://jsfiddle.net/NbzDK/

html

<img src="whatever.jpg" class="scaled" />

css

.scaled{
    width: 300px;
    /* height will adjust automatically to fit */
}
Nightfirecat
  • 11,432
  • 6
  • 35
  • 51
  • but this will not adjusted proportional to height right? – user1753971 Oct 22 '12 at 06:45
  • Check the example. I see a 400x400px image next to a 300x300px image next to a 200x200px image, and they were all resized only using the CSS `width` property and nothing else. – Nightfirecat Oct 22 '12 at 06:48
2

Yo can also use this syntax.

<IMG SRC=...... style="width:70px; height:auto;">  
Prem
  • 697
  • 3
  • 10
  • 1
    Inline styles are generally considered to be very inflexible, and very poor code style. What if this needed to be applied to tens or hundreds of images? What if the exact width needed to be changed? Both of these problems would be solved easily by using IDs or classes instead. – Nightfirecat Oct 22 '12 at 07:01