php8.5
Home/ Manual/ image / functions/ imagedestroy

imagedestroy

PHP function Deprecated as of PHP 8.5.0 Edit on GitHub ✎

(PHP 4, PHP 5, PHP 7, PHP 8)

Destroy an image

Function-8-5-0

Description

imagedestroy(GdImage $image): true

0-dead-function

Prior to PHP 8.0.0, imagedestroy() freed any memory associated with the image resource. As of 8.0.0, the GD extension uses objects instead of resources, and objects cannot be explicitly closed.

Parameters

Return Values

Always

Changelog

VersionDescription
8.5.0This function has been deprecated.
8.0.0This function is a NOP now.

Examples

Using imagedestroy() prior to PHP 8.0.0

php
<?php
// create a 100 x 100 image
$im = imagecreatetruecolor(100, 100);

// alter or save the image

// frees image from memory
imagedestroy($im);
?>

Source: reference/image/functions/imagedestroy.xml · from the official PHP manual (php/doc-en)