本文整理汇总了PHP中Intervention\Image\Image::trim方法的典型用法代码示例。如果您正苦于以下问题:PHP Image::trim方法的具体用法?PHP Image::trim怎么用?PHP Image::trim使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Intervention\Image\Image
的用法示例。
在下文中一共展示了Image::trim方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* 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;
}
示例2: testTrimToleranceOutOfBounds
/**
* @expectedException Intervention\Image\Exception\TrimToleranceOutOfBoundsException
*/
public function testTrimToleranceOutOfBounds()
{
$img = new Image();
$img->trim(null, null, 200);
}
示例3: trim
/**
* 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);
}
示例4: trim
/**
* 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);
}
示例5: handle
/**
* 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']);
}