class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
As of now, there is no way to do this. But it is a good idea, and I will try to implement it in a future version. Maybe the next release if I can find enough time.
But just one question: what happens if your original picture has a 1:50 ratio for instance? The algorithm you loosely described in your post will result in a very wide (or high) image. I suppose maybe there should be some boundaries (max ratio, or max width, or max height) so that you don't find yourself with such pictures, unless you really want to.Reply
As of now, there is no way to do this. But it is a good idea, and I will try to implement it in a future version. Maybe the next release if I can find enough time.
But just one question: what happens if your original picture has a 1:50 ratio for instance? The algorithm you loosely described in your post will result in a very wide (or high) image. I suppose maybe there should be some boundaries (max ratio, or max width, or max height) so that you don't find yourself with such pictures, unless you really want to.