本文整理匯總了PHP中Imagine\Image\ImageInterface::effects方法的典型用法代碼示例。如果您正苦於以下問題:PHP ImageInterface::effects方法的具體用法?PHP ImageInterface::effects怎麽用?PHP ImageInterface::effects使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Imagine\Image\ImageInterface
的用法示例。
在下文中一共展示了ImageInterface::effects方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: imageBlur
/**
* Command image blur
*
* @param float $sigma
*
* @return void
*/
protected function imageBlur($sigma = 1)
{
$sigma = (double) $sigma;
$this->image->effects()->blur($sigma);
}
示例2: load
public function load(ImageInterface $image, array $options = array())
{
$image->effects()->grayscale();
return $image;
}
示例3: applyEffect
/**
* Применяет эффект к изображению.
* @param ImageInterface $Image
* @param string $effect
* @param string $additional
* @return bool
*/
private function applyEffect(ImageInterface $Image, $effect, $additional = null)
{
switch ($effect) {
case 'resize':
if (!isset($additional['width']) || !isset($additional['height'])) {
return false;
}
$Image->resize(new Box($additional['width'], $additional['height']));
break;
case 'origin':
break;
case 'negative':
$Image->effects()->negative();
break;
case 'grayscale':
$Image->effects()->grayscale();
break;
case 'sharpen':
$Image->effects()->sharpen();
break;
case 'colorize':
$Image->effects()->colorize($Image->palette()->color($additional));
break;
case 'gamma':
$Image->effects()->gamma($additional);
break;
case 'blur':
$Image->effects()->blur($additional);
break;
default:
return false;
}
return true;
}
示例4: filterColorize
/**
* Apply colorize filter
*
* @param ImageInterface $image An image instance
* @param string $color The hex value of the color
* @return void
*/
protected function filterColorize(ImageInterface $image, $color)
{
$color = $image->palette()->color($color);
$image->effects()->colorize($color);
return $image;
}
示例5: applyColorizeFilter
/**
* @param \Imagine\Image\ImageInterface $image
* @param array $options
* @return \Imagine\Image\ImageInterface
*/
protected function applyColorizeFilter(ImageInterface $image, $options)
{
if (isset($options['color'])) {
$color = $image->palette()->color($options['color']);
$image->effects()->colorize($color);
}
return $image;
}
示例6: applyEffect
/**
* Применяет эффект к изображению.
* @param ImageInterface $Image
* @param string $effect
* @param string $additional
* @return bool
*/
private function applyEffect(ImageInterface $Image, $effect, $additional = null)
{
switch ($effect) {
case 'origin':
break;
case 'negative':
$Image->effects()->negative();
break;
case 'grayscale':
$Image->effects()->grayscale();
break;
case 'sharpen':
$Image->effects()->sharpen();
break;
case 'colorize':
$Image->effects()->colorize($Image->palette()->color($additional));
break;
case 'gamma':
$Image->effects()->gamma($additional);
break;
case 'blur':
$Image->effects()->blur($additional);
break;
default:
return false;
}
return true;
}