PHP Imagick displayImages () Function

PHP

Syntax:
bool Imagick::displayImages (string $servername)
Parameters:This function takes one parameter $servername,which contains the name of the X server.Return value:this function returns True on success.Errors / Exceptions:this function throws a exceptionImagickException on error.The following programs illustrate the function Imagick::displayImages() in PHP:Program 1:  
// Create an Imagick object $imagick = new Imagick ( ' https://media.engineerforengineer.org /wp-content/uploads/engineerforengineer-9.png ' );  
// Using the displayImage function $imagick -> displayImage ( 'servername' ); header ( " Content-Type: image / jpg " );  
// Display the output image echo $imagick -> getImageBlob(); ?>
Output: Program 2: $string = "Computer Science portal for Geeks!" ;  
// Create a new image of the above line // and add color and background $im = new Imagick(); $draw = new ImagickDraw();  
// Fill the color in the image $draw -> setFillColor ( new ImagickPixel ( 'green' ));  
// Set the text font size $draw -> setFontSize (50); $metrix = $im -> queryFontMetrics ( $draw , $string ); $draw -> annotation (0, 40, $string ); $im -> newImage ( $metrix [ 'textWidth' ], $metrix [ 'textHeight' ], new ImagickPixel ( 'white' ));  
// Draw image $im -> drawImage ( $draw );  
// Using the displayImage function $im -> displayImage ( 'servername' ); $im -> setImageFormat ( ' png' ); header ( " Content-Type: image / jpg " );  
// Display the output image echo $im -> getImageBlob(); ?>
Output: Link: https://www.php.net/manual/en/imagick.displayimages.php