Pop\Image\Gd::crop PHP Метод

crop() публичный Метод

Crop the image object
public crop ( integer | string $wid, integer | string $hgt, integer | string $x, integer | string $y ) : mixed
$wid integer | string
$hgt integer | string
$x integer | string
$y integer | string
Результат mixed
    public function crop($wid, $hgt, $x = 0, $y = 0)
    {
        // Create a new image output resource.
        $this->createResource();
        $this->output = imagecreatetruecolor($wid, $hgt);
        // Copy newly sized image to the output resource.
        $this->copyImage($this->width, $this->height, $x, $y);
        return $this;
    }

Usage Example

Пример #1
0
 public function testCrop()
 {
     $i = new Gd(__DIR__ . '/../tmp/test.jpg');
     $i->crop(100, 50);
     $this->assertEquals(100, $i->getWidth());
 }