PHP | Imagick setRegistry() Function

The Imagick::setRegistry() function is an inbuilt function in PHP which is used to set the ImageMagick registry entry with named key to value. This function is userful to set the “temporary-path” which is used to control where ImageMagick creates temporary images.

Syntax:

bool Imagick::setRegistry( string $key, string $value )

Parameters: This function accepts two parameters as mentioned above and described below:

  • $key: This parameter holds the key of the registry.
  • $value: This parameter holds the value of the registry.

Return Value: This function returns TRUE on success.

Below program illustrates the Imagick::setRegistry() function in PHP:



Program:

filter_none

edit
close

play_arrow

link
brightness_4
code

<?php
  
// Create a new Imagick object
$imagick = new Imagick();
  
// Setting the ImageMagick registry
$imagick->setRegistry('key1', 'value1');
$imagick->setRegistry('key2', 'value2');
  
  
// Getting all the ImageMagick registry
$regs = $imagick->listRegistry();
  
// Displaying the array
foreach($regs as $key => $value) {
    echo "$key => $value";
    echo nl2br("\n");
}
  
?>

chevron_right


Output:

key1 => value1
key2 => value2

Reference: https://www.php.net/manual/en/imagick.setregistry.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.