Syntax:bool Imagick::encipherImage ($passphrase)
Parameters: This function takes one parameter $passphrase,which contains the password value.Return Value:Returns True on success or False on failure. The following program illustrates the Imagick::encipherImage() function in PHP:Program :
// Create a new Imagick object
$image
=
new
Imagick (
’ https://media.engineerforengineer.org/wp-content/uploads/engineerforengineer-9.png ’
);
// Create a passphrase
$passphrase
=
"GeeksforGeeks"
;
// Function call
$image
-> encipherImage (
$passphrase
);
// $image is now encrypted with a string
// & quot; GeeksforGeeks & quot;
// $image can be made read-only
// decipherImage() method
// with the same passphrase as a parameter
header (
"Content-Type: image / jpg "
);
// Displays a decoded image that
// just like our sampleimage.jpeg
echo
$image
;
?>
Output: Decrypted image if password is incorrect:
Link: https://php.net/manual/en/imagick.encipherimage.php