I'm using Imagick lib to do some modifications to original image. Then I'd like to output it directly to browser without saving. Is there a way to do that?
I tried to use Imagick::writeImage('STDOUT')
(empty output) and 'php://stdout' with error "Unable to write to file".
Any ideas? :)
You just need to echo your imagick object:
$img = new Imagick($file);
header('Content-Type: image/'.$img->getImageFormat());
echo $img;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With