PHP Imagick montageImage () function

PHP

Syntax:
Imagick Imagick::montageImage (ImagickDraw $draw, string  $tile_geometry, string $thumbnail_geometry, int $mode, string $frame)
Parameters: This function takes five parameters as above and described below:
  • $draw:defines the name, size and color of the font.
  • $tile_geometry:defines the number of tiles per line and page.
  • $thumbnail_geometry:defines the preferred image size and border size for each thumbnail.
  • $mode:contains an integer value corresponding to one of MONTAGEMODE constants .
  • $frame:Indicates whether the image is surrounded by an ornamental frame.
List of all constants M ONTAGEMODE is shown below:
  • imagick::MONTAGEMODE_FRAME (1)
  • imagick::MONTAGEMODE_UNFRAME (2)
  • imagick::MONTAGEMODE_CONCATENATE (3)
Return Value:This function returns a new Imagick object on success.Exceptions:This function throws ImagickException on error.The following programs illustrate the Imagick::montageImage() functionin PHP:Program 1:  
// Create a new Imagick object $imagick = new Imagick ( ` https://media.engineerforengineer.org/wp-content/uploads/engineerforengineer-13.png ` );  
// Create edit $result = $imagick -> montageImage ( new ImagickDraw(), `4x2` , `150x100 + 2 + 2 ` , imagick::MONTAGEMODE_UNFRAME, " 2x2 + 3 + 3 " );  
// Show image $result -> setImageFormat ( `png` ); header ( "Content-Type: image / png" ); echo $result -> getImageBlob(); ?>
Output: Program 2:  
// Create new Imagick object $imagick = new Imagick();  
// Create a new tagged image $imagick -> newimage (1000, 800, `green` ); $imagick -> labelImage ( `green` );  
// Add a new tagged image $imagick -> addImage ( new imagick ( ` https://media.engineerforengineer.org/wp-content/uploads/engineerforengineer-13.png ` )); $imagick -> labelImage ( ` Image1` );  
// Add a new tagged image $imagick -> addImage ( new imagick ( ` https://media.engineerforengineer.org/wp-content/uploads/20190918234528/colorize1.png ` )); $imagick -> labelImage ( ` Image2` );  
// Create a new tagged image $imagick -> newimage (1000, 800, `blue` ); $imagick -> labelImage ( `blue` );  
// Create a new tagged image $imagick -> newimage (1000, 800, `violet` ); $imagick -> labelImage ( `violet` );  
// Create a new tagged image $imagick -> newimage (1000, 800, `cyan` ); $imagick -> labelImage ( `cyan` );  
// Create edit $result = $imagick -> montageImage ( new ImagickDraw(), "3x2 + 0 +0 " , " 200x160 + 3 + 3 > " , Imagick::MONTAGEMODE_CONCATENATE, " 10x10 + 2 + 2 " );  
// Show image $result -> setImageFormat ( `png` ); header ( "Content-Type: image / png" ); echo $result -> getImageBlob(); ?>
Output: Link: https://www.php.net/manual/en/imagick.montageimage.php



Get Solution for free from DataCamp guru