本文整理汇总了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;
}