The Imagick::getImageAttribute() function is an inbuilt function in PHP which is used to get the named attribute of a key.
Syntax:
string Imagick::getImageAttribute( string $key )
Parameters: This function accepts single parameter $key which holds the key value in string format.
Return Value: This function returns a string value on success.
Below programs illustrate the Imagick::getImageAttribute() function in PHP:
Program 1:
<?php   // Create a Imagick object $imagick = new Imagick(   // Get the attribute with key 'hello' $attribute = $imagick->getImageAttribute('hello');   echo $attribute; ?> |
Output:
Empty string as it is the default value.
Program 2:
<?php   // Create a Imagick object $imagick = new Imagick(   // Set an attribute with key 'hello' $imagick->setImageAttribute('hello', 'world');   // Get the attribute with key 'hello' $attribute = $imagick->getImageAttribute('hello');   echo $attribute; ?> |
Output:
world
Reference: https://www.php.net/manual/en/imagick.getimageattribute.php
