KorsRatioThumbnailBundle is a project mainly written in PHP, it's free.
======================== Symfony 2 bundle which adds an Imagine filter which can resize images based on a width or height while constraining ratio of original image.
TBW