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 holds the path to an image to load or an array of paths. It can include wildcards for file names, or can be URLs.



Return Value: This function return a new Imagick object on successful execution.

Exception: This function throws ImagickException exception on error.

Program: This program loads the image using the URL of the image and display on the screen.

filter_none

edit
close

play_arrow

link
brightness_4
code

<?php
  
// Create a new Imagick object
$image = new Imagick(
  
// Browser should know that image is to be loaded on the page
header("Content-Type: image/png");
  
// Display the image object
echo $image;
  
?>

chevron_right


Output:

Reference: https://www.php.net/manual/en/imagick.construct.php



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.