Scales the size of an image to the given dimensions. The other parameter will be calculated if 0 is passed as either param.
function scaleImage($image_path, $scale_width, $scale_height)
{
    $imagick = new \Imagick(realpath($image_path));
    $imagick->scaleImage($scale_width, $scale_height, false);
    header("Content-Type: image/jpeg");
    echo $imagick->getImageBlob();
}