Syntax:Imagick Imagick::current (void)
Parameters: this function takes no parameters.
Return Value: Returns an instance of an Imagick object.
Program 1: This program is about simple the functioning of the current() method. It will create a variable with a new name pointing to the same instance and show the content of the old one with the new one.
// Create a new Imagick object
$im
=
new
Imagick (
’ https://media.engineerforengineer.org/wp-content/uploads/engineerforengineer-6.png ’
);
// Use the Imagick::current() function and
// initialized with Image
$im1
=
$im
-> current();
// The Imagick instance returned in the new $im1 variable
header (
"Content-type: image / png"
);
// Display the image as output
echo
$im1
;
?>
Output: Program 2: performs image blur operation using 2nd variable, and the change will be reflected in the first, since they both point to the same instance.
// Create a new Imagick object
$im
=
new
Imagick (
’ https://media.engineerforengineer.org/wp-content/uploads/engineerforengineer-6.png ’
);
// Using the Imagick::current() function
$im1
=
$im
-> current();
// Use the Imagick::blurImage() function to blur the image
$im1
-> blurImage (5, 3);
header (
" Content-type: image / png "
);
// Display the image as
echo
$im
;
?>
Output: Link: https://www.php.net/manual/en/imagick.current.php