I want to use images dynamically generated by ImageMagic from PHP

Asked 2 years ago, Updated 2 years ago, 103 views

I would like to synthesize images from PHP to Imagick, but I would like to load images that are dynamically generated by another PHP.

$prm="./makeimg?param...";// Images generated with specified parameters
$img = new Imagick(...); // I want to load here

When I want to pass a dynamic image created with $prm to Imagick(), do I have to write it to the file temporarily?
For example, is it necessary to retrieve image data from curl and export it with fwrite()?

php imagemagick

2022-09-30 14:29

1 Answers

You can pass the absolute URL to newImagick() without combining curl.

$img=newImagick('http://dummyimage.com/qvga');

On the other hand, if you want to use a local PHP script without going through a web server, you can pass GET parameters by calling it as CGI, but the output is mixed with headers, so it is troublesome to handle.

Wouldn't it be more convenient to cut the makeimg processing into functions or methods that return Imagic object or raw image data and call it directly from another script?


2022-09-30 14:29

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.