well I made this function to scale proportional, it uses a given width, height, and optionally the max width/height u want (depends on the given width and height)
(also posted this on stackoverflow in case you guys blame me of stealing code..)
usage:
then you just gotta use the $targ_w and $targ_h
