Saturday, September 6, 2025
HomeLanguagesPHP | Imagick setRegistry() Function

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 useful 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: 

php




<?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");
}
 
?>


Output:

key1 => value1
key2 => value2

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

RELATED ARTICLES

Most Popular

Dominic
32271 POSTS0 COMMENTS
Milvus
82 POSTS0 COMMENTS
Nango Kala
6641 POSTS0 COMMENTS
Nicole Veronica
11807 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11869 POSTS0 COMMENTS
Shaida Kate Naidoo
6754 POSTS0 COMMENTS
Ted Musemwa
7030 POSTS0 COMMENTS
Thapelo Manthata
6705 POSTS0 COMMENTS
Umr Jansen
6721 POSTS0 COMMENTS