function swirlImageWithMethod($image_path, $swirl, int $interpolate_method) { $imagick = new \Imagick(realpath($image_path)); $imagick->swirlImageWithMethod($swirl, $interpolate_method); header("Content-Type: image/jpeg"); echo $imagick->getImageBlob(); }