Syntax:string Imagick::getImageAttribute (string $key)
Parameters:This function takes one parameter,
$key,which contains the key value in string format.
Return value:this the function returns a string value on success.The following programs illustrate the
Imagick::getImageAttribute() functionin PHP:
Program 1:
// Create an Imagick object
$imagick
=
new
Imagick (
’ https://media.engineerforengineer.org/wp-content/uploads/engineerforengineer-13.png ’
);
// Get an attribute with the key "hello"
$attribute
=
$imagick
-> getImageAttribute (
’hello’
);
echo
$attribute
;
?>
Output:Empty string as it is the default value.
Program 2:
// Create an Imagick object
$imagick
=
new
Imagick (
’ https://media.engineerforengineer.org/wp-content/uploads/engineerforengineer-13.png ’
);
// Set attribute with key "hello"
$imagick
-> setImageAttribute (
’hello’
,
’world’
);
// Get an attribute with the key "hello"
$attribute
=
$imagick
-> getImageAttribute (
’hello’
);
echo
$attribute
;
?>
Output:world
Link: https://www .php.net / manual / en / imagick.getimageattribute.php