Most elegant image to image frame comparison algorithm
If we move past rewriting the boolean expressions and instead rework the formulas, I think we can get something a little easier to manage. 

If I understand correctly, your goal is to have the image cover the frame. That is to say, for the frame to be filled and the image cropped.

In that case, All we need to do is scale the image to the frame.

var imageHeight = 150, imageWidth = 310, height = 240, width = 300;

//Find the larget discrepancy between frame size and corresponding image size
var scaleRatio = Math.max( height/imageHeight, width/imageWidth );

//Apply the scale to the whole image.
imageHeight *= scaleRatio;
imageWidth *= scaleRatio;


If instead your desire it to have the image fit in the frame, then all we need to do is replace Math.max with Math.min.