/** * 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; }
/** * @expectedException Intervention\Image\Exception\TrimToleranceOutOfBoundsException */ public function testTrimToleranceOutOfBounds() { $img = new Image(); $img->trim(null, null, 200); }
/** * 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); }
/** * 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']); }