Issue
It is possible to get a binary blob by using ImageMagick convert
via PHP's shell_exec()
. It's very difficult to convert such a command to PHP Imagick class. Is there any alternative way to implement this feature?
I am using Imagick like this.
$im = new Imagick('some image');
$im->trimImage(20000);
header ("Content-Type: image/{$im->getImageFormat()}");
echo $im->getImageBlob(); // need output in from of blob
I want do get output result similar to this.
convert imageName.png -alpha set - white -border 1 -fill none -fuzz 3% -draw "color 0,0 floodfill" -shave 1x1 removed_edges.png
If ImageMagick command returns a binary blob instead of writing to a file, my problems will be solved.
Solution
Appended jpg:- after command instead of image name & it's working.
$command = "convert imageName.png -alpha set - white -border 1 -fill none -fuzz 3% -draw "color 0,0 floodfill" -shave 1x1 jpg:-";
header ("Content-Type: image/jpg");
echo shell_exec($command);
Answered By - Sumeet Roy Answer Checked By - Candace Johnson (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.