PHP | Imagick destroy() Function

The Imagick::destroy() function is an inbuilt function in PHP which is used to destroy the Imagick object and free all the resources associated with it. You can’t access your object content once it is destroyed.

Syntax:

bool Imagick::destroy( void )

Parameters: This function does not accept any parameters.



Return Value: This function returns TRUE on success.

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

Program:

filter_none

edit
close

play_arrow

link
brightness_4
code

<?php
  
// Create a new imagick object with image
$imagick = new Imagick(
  
// Use your $imagick object for whatever you want 
// to do here and destroy it after using it.
  
// Destroying that object
$imagick->destroy();
?>

chevron_right


Output: Since image distroyed so it will not display any image.

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