DestroyCommand.php 564 B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace Intervention\Image\Gd\Commands;
  3. use Intervention\Image\Commands\AbstractCommand;
  4. class DestroyCommand extends AbstractCommand
  5. {
  6. /**
  7. * Destroys current image core and frees up memory
  8. *
  9. * @param \Intervention\Image\Image $image
  10. * @return boolean
  11. */
  12. public function execute($image)
  13. {
  14. // destroy image core
  15. imagedestroy($image->getCore());
  16. // destroy backups
  17. foreach ($image->getBackups() as $backup) {
  18. imagedestroy($backup);
  19. }
  20. return true;
  21. }
  22. }