Imagick (Imagemagick on PHP): serve a file without saving to disk first?
I'm trying to use Imagemagick (actually PHP's Imagick) to create and output (serve) an image without saving it to disk first.
Currently I'm having to save the file and then use verot upload class to serve the im开发者_C百科age.
(Apache 2 server, PHP5)
Sure. This should work for you:
$image = new Imagick();
// Do your image creation stuff. Make sure to set $image->setImageFormat();
header('Content-Type: image/filetype'); // Change filetype
echo $image;
I admit to never having used Imagick, but just looking at the examples, echoing
the image should work just fine:
header('Content-type: image/jpeg');
$image = new Imagick('image.jpg');
echo $image;
精彩评论