function borderImage($image_path, $color, $width, $height) { $imagick = new \Imagick(realpath($image_path)); $imagick->borderImage($color, $width, $height); header("Content-Type: image/jpeg"); echo $imagick->getImageBlob(); }