Good best-practices replacement for TimThumb?

I'd like to put an image in a template, and rather than using the now troublesome timthumb, I'd like to call some better-practices image resizer code. Any tips for a function that can be passed a local file path, height, and width and get back an "<IMG SRC" full tag?

Basically, I have a bunch of TimThumb-reliant code and I need a substitute solution.

Thanks!