Rewrite resize function

The resize function is now extended so it supports more functionality. Parameter passing with arrays have been removed.

New functionality included:
- Resizing of a single image side
- Preserve image ratio when both width and height have been set (treated as maximum values)
- Prevent image from being upsized

Signed-off-by: Dries Vints <dries.vints@gmail.com>