On this page
imagedestroy
(PHP 4, PHP 5, PHP 7, PHP 8)
imagedestroy — Destroy an image
Description
imagedestroy(GdImage $image): bool
Note:
This function has no effect. Prior to PHP 8.0.0, this function was used to close the resource.
Prior to PHP 8.0.0, imagedestroy() freed any memory associated with image image.
Parameters
image-
A GdImage object, returned by one of the image creation functions, such as imagecreatetruecolor().
Return Values
Returns true on success or false on failure.
Changelog
| Version | Description |
|---|---|
| 8.0.0 | This function is a NOP now. |
| 8.0.0 | image expects a GdImage instance now; previously, a valid gd resource was expected. |
Examples
Example #1 Using imagedestroy() prior to PHP 8.0.0
<?php
// create a 100 x 100 image
$im = imagecreatetruecolor(100, 100);
// alter or save the image
// frees image from memory
imagedestroy($im);
?>
© 1997–2023 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://www.php.net/manual/en/function.imagedestroy.php