示例#1
0
 public function crop($left, $top, $width, $height)
 {
     list($left, $top, $width, $height) = Image::calculateCutout($this->getWidth(), $this->getHeight(), $left, $top, $width, $height);
     $newImage = static::fromBlank($width, $height, Image::RGB(0, 0, 0, 127))->getImageResource();
     imagecopy($newImage, $this->getImageResource(), 0, 0, $left, $top, $width, $height);
     $this->image = $newImage;
     return $this;
 }
示例#2
0
 public function crop($left, $top, $width, $height)
 {
     list($left, $top, $width, $height) = Image::calculateCutout($this->getWidth(), $this->getHeight(), $left, $top, $width, $height);
     $this->getImageResource()->cropImage($width, $height, $left, $top);
     return $this;
 }