Cheetah
BackupCommand.php
Go to the documentation of this file.
1 <?php
2 
4 
6 {
13  public function execute($image)
14  {
15  $backupName = $this->argument(0)->value();
16 
17  // clone current image resource
18  $size = $image->getSize();
19  $clone = imagecreatetruecolor($size->width, $size->height);
20  imagealphablending($clone, false);
21  imagesavealpha($clone, true);
22  $transparency = imagecolorallocatealpha($clone, 0, 0, 0, 127);
23  imagefill($clone, 0, 0, $transparency);
24 
25  // copy image to clone
26  imagecopy($clone, $image->getCore(), 0, 0, 0, 0, $size->width, $size->height);
27 
28  $image->setBackup($clone, $backupName);
29 
30  return true;
31  }
32 }
Intervention\Image\Gd\Commands
Definition: BackupCommand.php:3
php
Intervention\Image\Gd\Commands\BackupCommand\execute
execute($image)
Definition: BackupCommand.php:13
Intervention\Image\Gd\Commands\BackupCommand
Definition: BackupCommand.php:6
Intervention\Image\Commands\AbstractCommand\argument
argument($key)
Definition: AbstractCommand.php:45
Intervention\Image\Commands\AbstractCommand
Definition: AbstractCommand.php:6