Resample image to desired resolution.
Image
Resample image to desired resolution.
Parameters
x_resolutionfloat
y_resolutionfloat
filterint
blurfloat
function resampleImage($imagePath)
{
    $imagick = new \Imagick(realpath($imagePath));

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