<?php
namespace Intervention\Image\Gd\Commands;
use Intervention\Image\Commands\AbstractCommand;
class InsertCommand extends AbstractCommand
{
/**
* Insert another image into given image
*
* @param \Intervention\Image\Image $image
* @return boolean
*/
public function execute($image)
{
$source = $this->argument(0)->required()->value();
$position = $this->argument(1)->type('string')->value();
$x = $this->argument(2)->type('digit')->value(0);
$y = $this->argument(3)->type('digit')->value(0);
// build watermark
$watermark = $image->getDriver()->init($source);
// define insertion point
$image_size = $image->getSize()->align($position, $x, $y);
$watermark_size = $watermark->getSize()->align($position);
$target = $image_size->relativePosition($watermark_size);
// insert image at position
imagealphablending($image->getCore(), true);
return imagecopy($image->getCore(), $watermark->getCore(), $target->x, $target->y, 0, 0, $watermark_size->width, $watermark_size->height);
}
}
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.