<?php
namespace Intervention\Image\Gd\Commands;
use Intervention\Image\Commands\AbstractCommand;
use Intervention\Image\Exception\RuntimeException;
class ResetCommand extends AbstractCommand
{
/**
* Resets given image to its backup state
*
* @param \Intervention\Image\Image $image
* @return boolean
*/
public function execute($image)
{
$backupName = $this->argument(0)->value();
$backup = $image->getBackup($backupName);
if (is_resource($backup) || $backup instanceof \GdImage) {
// destroy current resource
imagedestroy($image->getCore());
// clone backup
$backup = $image->getDriver()->cloneCore($backup);
// reset to new resource
$image->setCore($backup);
return true;
}
throw new RuntimeException(
"Backup not available. Call backup() before reset()."
);
}
}
How To Payment
Making a payment on our website is quick and secure. Start by logging in or creating an account. Select your preferred payment method, input the required details, and review the information. Once you confirm everything is correct, click on the "Submit Payment" button. You’ll receive instant confirmation and can track your payment status through your account dashboard. It’s an easy and secure process.