示例#1
0
 function crop($left, $top, $width, $height)
 {
     if ($this->file === NULL) {
         return parent::crop($left, $top, $width, $height);
     }
     list($left, $top, $width, $height) = self::calculateCutout($this->getWidth(), $this->getHeight(), $left, $top, $width, $height);
     $this->execute("convert -crop {$width}x{$height}+{$left}+{$top} -strip %input %output", self::PNG);
     return $this;
 }
示例#2
0
文件: loader.php 项目: GE3/GE3
 function crop($left, $top, $width, $height)
 {
     if ($this->file === NULL) {
         return parent::crop($left, $top, $width, $height);
     }
     $left = max(0, (int) $left);
     $top = max(0, (int) $top);
     $width = min((int) $width, $this->getWidth() - $left);
     $height = min((int) $height, $this->getHeight() - $top);
     $this->execute("convert -crop {$width}x{$height}+{$left}+{$top} -strip %input %output", self::PNG);
     return $this;
 }