问题
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 image.
(Apache 2 server, PHP5)
回答1:
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;
回答2:
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;
来源:https://stackoverflow.com/questions/3369739/imagick-imagemagick-on-php-serve-a-file-without-saving-to-disk-first