Open In App

PHP | Imagick getRegistry() Function

Last Updated : 28 Nov, 2019
Comments
Improve
Suggest changes
Like Article
Like
Report
The Imagick::getRegistry() function is an inbuilt function in PHP which is used to get the StringRegistry entry for the named key or false if not set. Syntax:
string Imagick::getRegistry( string $key )
Parameters: This function accepts a single parameter $key which holds the key. Return Value: This function returns a string value containing the value associated with the key. Exceptions: This function throws ImagickException on error. Below given programs illustrate the Imagick::getRegistry() function in PHP: Program 1: php
<?php

// Create a new imagick object
$imagick = new Imagick(
'https://media.geeksforgeeks.org/wp-content/uploads/20190918234528/colorize1.png');

// Get the Registry
$registry = $imagick->getRegistry('key');
echo $registry;
?>
Output:
// Empty string because no registry with key as 'key' is set.
Program 2: php
<?php

// Create a new imagick object
$imagick = new Imagick(
'https://media.geeksforgeeks.org/wp-content/uploads/20190918234528/colorize1.png');

// Set the Registry
$imagick->setRegistry('key', 'my_value');

// Get the Registry
$registry = $imagick->getRegistry('key');
echo $registry;
?>
Output:
my_value
Reference: https://www.php.net/manual/en/imagick.getregistry.php

Next Article

Similar Reads