Extend resize function. Fixes #1

This rewrite of the resize function does what I mean in #1. When both width and hight are passed with a boolean ratio flag, the width and hight get treated as maximum values. 

The new function also allows for some more functionality like:
- Only resize one side of an image
- Prevent an image from being upsized

It still works with auto calculating either width or hight depending on which one got passed along. You just need to set 2 more parameters but that's trivial if you see what flexibility this gives you.

If you should accept this pull request, documentation needs to be updated ;)

Thanks for taking a look! :)