PHP Imagick frameImage () function

PHP

Syntax:
bool Imagick::frameImage ($color, $width, $height, $inner_bevel, $outer_bevel)  Parameters:This function takes five parameters as above and described below:
  • $color:border color that can be a string or hexadecimal.
  • $width:sets the width of the border.
  • $height:sets the height of the border.
  • $inner_bevel:sets the width of the inner bevel shadow.
  • $external_bevel:sets the width of the outer bevel shadow.
Return Value:Returns True on success or False on failure.The following programs illustrate the Imagick::frameImage() function in PHP: Program 1: & l t;? php  
// Create an Imagick object $imagick = new Imagick ( ' https://media.engineerforengineer.org/wp-content/uploads/engineerforengineer-9.png ' );  
// Using the frameImage function $imagick -> frameImage ( 'yellow' , 30, 30, 10, 10); header ( " Content-Type: image / jpg " );  
// Display the output image echo $imagick -> getImageBlob();  
?>
Output: Program 2:  
// Create new Imagick object $image = new Imagick (__ DIR__. 'sample_image.jpeg' );  
// Set the parameter value $color = "# 211544" ; $width_of_frame = 30; $height_of_frame = 40; $inner_Bevel = 15; $outer_Bevel = 15;  
// Call the function with parameters $image -> frameImage ( $color , $width_of_frame , $height_of_frame , $inner_Bevel , $outer_Bevel); header ( ' Content-type: image / jpeg' );  
// Write a new image to the specified directory $image -> writeImage (__ DIR__. 'sample_image_with_border2.jpeg ' );  
?>
Output: Program 3:  
// Create a function that takes parameters
// and returns a framed image object function frame_image ( $Imagik_obj , $color , $width_of_frame , $height_of_frame , $inner_bevel , $outer_bevel ) { $Imagik_obj -> frameImage ( $color , $width_of_frame , $height_of_frame , $inner_Bevel , $outer_Bevel ); return $Imagik_obj ; }  
// Call the function with parameters echo frame_image ( new Imagick (__ DIR__. 'sample_image.jpeg' ), "# 211544" , 30, 40, 15, 15) -> getImageBlob(); header ( ' Content-type: image / jpeg' );  
?>
Output: Link: https://www.php.net/manual/en/imagick.frameimage.php
Please comment if you find something wrong or want to add more information. Happy coding!



Get Solution for free from DataCamp guru