Beispiel #1
0
 /**
  * Perform trim image manipulation.
  * @param  Image $image The source image.
  * @return Image The manipulated image.
  */
 public function run(Image $image)
 {
     $trim = $this->getTrim();
     if ($trim) {
         $image->trim('top-left', null, $trim);
     }
     return $image;
 }
Beispiel #2
0
 /**
  * @expectedException Intervention\Image\Exception\TrimToleranceOutOfBoundsException
  */
 public function testTrimToleranceOutOfBounds()
 {
     $img = new Image();
     $img->trim(null, null, 200);
 }
Beispiel #3
0
 /**
  * Trim away image space in given color
  *
  * @param string $base Position of the color to trim away
  * @param array $away Borders to trim away
  * @return \Intervention\Image\Image 
  * @static 
  */
 public static function trim($base = null, $away = null)
 {
     return \Intervention\Image\Image::trim($base, $away);
 }
 /**
  * Trim away image space in given color
  *
  * @param string $base Position of the color to trim away
  * @param array $away Borders to trim away
  * @param int $tolerance Tolerance of color comparison
  * @param int $feather Amount of pixels outside (when positive) or inside (when negative) of the strict limit of the matched color
  * @return \Intervention\Image\Image 
  * @static 
  */
 public static function trim($base = null, $away = null, $tolerance = null, $feather = 0)
 {
     return \Intervention\Image\Image::trim($base, $away, $tolerance, $feather);
 }
Beispiel #5
0
 /**
  * Handle the image manipulation request
  * @param  \Intervention\Image\Image $image
  * @param  array                     $options
  * @return \Intervention\Image\Image
  */
 public function handle($image, $options)
 {
     $options = array_merge($this->defaults, $options);
     return $image->trim($options['base'], $options['away'], $options['tolerance'], $options['feather']);
 }