Resample image to desired resolution.
function resampleImage($image_path)
{
    $imagick = new \Imagick(realpath($image_path));

    $imagick->resampleImage(200, 200, \Imagick::FILTER_LANCZOS, 1);
    header("Content-Type: image/jpg");
    echo $imagick->getImageBlob();
}