<?php
namespace Intervention\Image\Gd\Commands;
use Intervention\Image\Commands\AbstractCommand;
class DestroyCommand extends AbstractCommand
{
/**
* Destroys current image core and frees up memory
*
* @param \Intervention\Image\Image $image
* @return boolean
*/
public function execute($image)
{
// destroy image core
imagedestroy($image->getCore());
// destroy backups
foreach ($image->getBackups() as $backup) {
imagedestroy($backup);
}
return true;
}
}
In case of an error, the API will return an error response containing a specific error code 400, 403 Failed and a user-friendly message. Refer to our API documentation for a comprehensive list of error codes and their descriptions.