Setting a max height onResize
<p>I have a script that uses this function to resize images onLoad and onResize:</p>

<pre><code>/**
 * Calculates the display width of an image depending on its display height when it is resized.
 * @param displayHeight the resized height of the image
 * @param originalHeight the original height of the image
 * @param originalWidth the original width of the image
 * @return the display width
 */
function getDisplayWidth(displayHeight, originalHeight, originalWidth){
    var ratio = originalHeight/displayHeight,
        res = Math.round(originalWidth/ratio) || 1000;
    return res;
}
</code></pre>

<p>.. but I do NOT want to the image height to exceed 800px, infact it can even be a fixed at 800×530px size. I tried to return a fixed value to <code>res</code> but it doesn't seem to work.</p>

<p>Thanks!</p>
