title: Image resize while keeping ratio
body: <p>I'm listing photos using MySQL:</p>
  
  <pre><code>&lt;?php
  $a = mysql_query("select * from x");
  ?&gt;
  &lt;?php while ($w=mysql_fetch_array($a)) { ?&gt;
      &lt;img src="&lt;?=$w[url]?&gt;" alt="&lt;?=$w[name]?&gt;" width="150" height="110" /&gt;
  &lt;? } ?&gt;
  </code></pre>
  
  <p>How can I can maintain the aspect ratio? An image with dimensions of 150x500 pixels becomes very distorted. How can I fix this?</p>