I didn't explain this very well yesterday.
What this patch does is let the administrator set the max logo height & width in the config file.
Then as long as an image does not exceed the max logo height, or the max width, or both the max logo height & width, it will display the original dimensions of the image without distorting it.
If the image is too long, it will set the width.
If the image is too high, it will set the height.
If it is both, then it will set both height & width.
If it is neither, then the image will maintain it's original size.
Hope this explains what this code is trying to acomplish.