mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-07 00:17:03 +03:00
Added: Incorrect image orientation
This commit is contained in:
parent
217207883f
commit
e3b62d24d8
87 changed files with 10461 additions and 21 deletions
106
rainloop/v/0.0.0/app/libraries/Imagine/Gmagick/Effects.php
Normal file
106
rainloop/v/0.0.0/app/libraries/Imagine/Gmagick/Effects.php
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Imagine package.
|
||||
*
|
||||
* (c) Bulat Shakirzyanov <mallluhuct@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Imagine\Gmagick;
|
||||
|
||||
use Imagine\Effects\EffectsInterface;
|
||||
use Imagine\Exception\RuntimeException;
|
||||
use Imagine\Image\Palette\Color\ColorInterface;
|
||||
use Imagine\Exception\NotSupportedException;
|
||||
|
||||
/**
|
||||
* Effects implementation using the Gmagick PHP extension
|
||||
*/
|
||||
class Effects implements EffectsInterface
|
||||
{
|
||||
private $gmagick;
|
||||
|
||||
public function __construct(\Gmagick $gmagick)
|
||||
{
|
||||
$this->gmagick = $gmagick;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function gamma($correction)
|
||||
{
|
||||
try {
|
||||
$this->gmagick->gammaimage($correction);
|
||||
} catch (\GmagickException $e) {
|
||||
throw new RuntimeException('Failed to apply gamma correction to the image');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function negative()
|
||||
{
|
||||
if (!method_exists($this->gmagick, 'negateimage')) {
|
||||
throw new NotSupportedException('Gmagick version 1.1.0 RC3 is required for negative effect');
|
||||
}
|
||||
|
||||
try {
|
||||
$this->gmagick->negateimage(false, \Gmagick::CHANNEL_ALL);
|
||||
} catch (\GmagickException $e) {
|
||||
throw new RuntimeException('Failed to negate the image');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function grayscale()
|
||||
{
|
||||
try {
|
||||
$this->gmagick->setImageType(2);
|
||||
} catch (\GmagickException $e) {
|
||||
throw new RuntimeException('Failed to grayscale the image');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function colorize(ColorInterface $color)
|
||||
{
|
||||
throw new NotSupportedException('Gmagick does not support colorize');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function sharpen()
|
||||
{
|
||||
throw new NotSupportedException('Gmagick does not support sharpen yet');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function blur($sigma = 1)
|
||||
{
|
||||
try {
|
||||
$this->gmagick->blurImage(0, $sigma);
|
||||
} catch (\GmagickException $e) {
|
||||
throw new RuntimeException('Failed to blur the image', $e->getCode(), $e);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue