本文整理匯總了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']);
}