PHP | Gmagick __construct() Function Last Updated : 21 Jan, 2020 Comments Improve Suggest changes Like Article Like Report The Gmagick::__construct() function is an inbuilt function in PHP which is used to create a Gmagick object. Further Gmagick manipulations can be done with this newly created Gmagick object. Syntax: public Gmagick::__construct( string $filename ) Parameters: This function accepts a single parameter $filename which holds the name of the file. Return Value: This function returns a new Gmagick object on success. Exceptions: This function throws GmagickException on error. Below programs illustrate the Gmagick::__construct() function in PHP: Program 1: This program display an image in the browser. php <?php // Create a new Gmagick object // https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png $gmagick = new Gmagick('geeksforgeeks.png'); // Output the image to browser header('Content-type: image/png'); echo $gmagick; ?> Output: Program 2: This program display an bordered image. php <?php // Create a new Gmagick object // https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png $gmagick = new Gmagick('geeksforgeeks.png'); // Border the image $gmagick->borderimage('red', 20, 20); // Output the image to browser header('Content-type: image/png'); echo $gmagick; ?> Output: Reference: https://www.php.net/manual/en/gmagick.construct.php Comment More infoAdvertise with us Next Article PHP | Gmagick __construct() Function gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Gmagick Similar Reads PHP | Imagick __construct() Function The Imagick::__construct() function is an Imagick class constructor which takes the image path or image URL as parameter to instantiate the Imagick object for a specific image or a set of images. Syntax: Imagick::__construct( $files ) Parameters: This function accepts single parameter $files which h 1 min read PHP | GmagickPixel __construct() Function The GmagickPixel::__construct() function is an inbuilt function in PHP which is used to construct an GmagickPixel object. If a color is specified, the object is constructed and then initialized with that color before being returned. Syntax: GmagickPixel GmagickPixel::__construct( string $color ) Par 1 min read PHP | ImagickDraw __construct() Function The ImagickDraw::__construct() function is an inbuilt function in PHP which is used to initialize a ImagickDraw object. Syntax: bool ImagickDraw::__construct( void ) Parameters: This function doesnât accept any parameter. Return Value: This function returns TRUE on success. Exceptions: This function 1 min read PHP | Gmagick current() Function The Gmagick::current() function is an inbuilt function in PHP which is used to return the reference of the current Gmagick object. This function does not create any copy but returns the same instance of Gmagick. Syntax: Gmagick Gmagick::current( void ) Parameters: This function doesnât accept any pa 1 min read PHP | Gmagick destroy() Function The Gmagick::destroy() function is an inbuilt function in PHP which is used to destroy the Gmagick object and frees all resources associated with it. Syntax: bool Gmagick::destroy( void ) Parameters: This function doesnât accept any parameter. Return Value: This function returns TRUE on success. Exc 1 min read Like