This class provides a easy to use but still powerful way to scale images.

Kwf_Media_Image::calculateScaleDimensions($source, $targetSize): returns the size of the scaled image

Kwf_Media_Image::scale($source, $targetSize): returns the contents of the scaled image

Kwf_Media_Image also correctly converts CMYK images to RGB, strips unneded data and rotates image according to exif data.

$targetSize parameter must be an array with the following entries:

if width or height is 0 and aspectRatio not used the target size will be calculated using the ratio of the original image. possible scaling methods: