Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
56 changed files
with
2,391 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the `liip/LiipImagineBundle` project. | ||
* | ||
* (c) https://github.com/liip/LiipImagineBundle/graphs/contributors | ||
* | ||
* For the full copyright and license information, please view the LICENSE.md | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Liip\ImagineBundle\Config\Filter\Argument; | ||
|
||
/** | ||
* @codeCoverageIgnore | ||
*/ | ||
final class Point | ||
{ | ||
/** | ||
* @var int | ||
*/ | ||
private $x; | ||
|
||
/** | ||
* @var int | ||
*/ | ||
private $y; | ||
|
||
public function __construct(int $x = null, int $y = null) | ||
{ | ||
$this->x = $x; | ||
$this->y = $y; | ||
} | ||
|
||
public function getX(): ?int | ||
{ | ||
return $this->x; | ||
} | ||
|
||
public function getY(): ?int | ||
{ | ||
return $this->y; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the `liip/LiipImagineBundle` project. | ||
* | ||
* (c) https://github.com/liip/LiipImagineBundle/graphs/contributors | ||
* | ||
* For the full copyright and license information, please view the LICENSE.md | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Liip\ImagineBundle\Config\Filter\Argument; | ||
|
||
/** | ||
* @codeCoverageIgnore | ||
*/ | ||
final class Size | ||
{ | ||
/** | ||
* @var int | ||
*/ | ||
private $width; | ||
|
||
/** | ||
* @var int | ||
*/ | ||
private $height; | ||
|
||
/** | ||
* To allow keeping aspect ratio, it is allowed to only specify one of width or height. | ||
* It is however not allowed to specify neither dimension. | ||
*/ | ||
public function __construct(int $width = null, int $height = null) | ||
{ | ||
$this->width = $width; | ||
$this->height = $height; | ||
} | ||
|
||
public function getWidth(): ?int | ||
{ | ||
return $this->width; | ||
} | ||
|
||
public function getHeight(): ?int | ||
{ | ||
return $this->height; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the `liip/LiipImagineBundle` project. | ||
* | ||
* (c) https://github.com/liip/LiipImagineBundle/graphs/contributors | ||
* | ||
* For the full copyright and license information, please view the LICENSE.md | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Liip\ImagineBundle\Config\Filter\Type; | ||
|
||
/** | ||
* @codeCoverageIgnore | ||
*/ | ||
final class AutoRotate extends FilterAbstract | ||
{ | ||
const NAME = 'auto_rotate'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the `liip/LiipImagineBundle` project. | ||
* | ||
* (c) https://github.com/liip/LiipImagineBundle/graphs/contributors | ||
* | ||
* For the full copyright and license information, please view the LICENSE.md | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Liip\ImagineBundle\Config\Filter\Type; | ||
|
||
use Liip\ImagineBundle\Config\Filter\Argument\Size; | ||
|
||
/** | ||
* @codeCoverageIgnore | ||
*/ | ||
final class Background extends FilterAbstract | ||
{ | ||
const NAME = 'background'; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $color; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $transparency; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $position; | ||
|
||
/** | ||
* @var Size | ||
*/ | ||
private $size; | ||
|
||
/** | ||
* @param string|null $color background color HEX value | ||
* @param string|null $transparency possible values 0..100 | ||
* @param string|null $position position of the input image on the newly created background image. Valid values: topleft, top, topright, left, center, right, bottomleft, bottom, and bottomright | ||
* @param Size $size | ||
*/ | ||
public function __construct( | ||
string $color = null, | ||
string $transparency = null, | ||
string $position = null, | ||
Size $size | ||
) { | ||
$this->color = $color; | ||
$this->transparency = $transparency; | ||
$this->position = $position; | ||
$this->size = $size; | ||
} | ||
|
||
public function getColor(): ?string | ||
{ | ||
return $this->color; | ||
} | ||
|
||
public function getTransparency(): ?string | ||
{ | ||
return $this->transparency; | ||
} | ||
|
||
public function getPosition(): ?string | ||
{ | ||
return $this->position; | ||
} | ||
|
||
public function getSize(): Size | ||
{ | ||
return $this->size; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the `liip/LiipImagineBundle` project. | ||
* | ||
* (c) https://github.com/liip/LiipImagineBundle/graphs/contributors | ||
* | ||
* For the full copyright and license information, please view the LICENSE.md | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Liip\ImagineBundle\Config\Filter\Type; | ||
|
||
use Liip\ImagineBundle\Config\Filter\Argument\Point; | ||
use Liip\ImagineBundle\Config\Filter\Argument\Size; | ||
|
||
/** | ||
* @codeCoverageIgnore | ||
*/ | ||
final class Crop extends FilterAbstract | ||
{ | ||
const NAME = 'crop'; | ||
|
||
/** | ||
* @var Point | ||
*/ | ||
private $startPoint; | ||
|
||
/** | ||
* @var Size | ||
*/ | ||
private $size; | ||
|
||
public function __construct(Point $startPoint, Size $size) | ||
{ | ||
$this->startPoint = $startPoint; | ||
$this->size = $size; | ||
} | ||
|
||
public function getStartPoint(): Point | ||
{ | ||
return $this->startPoint; | ||
} | ||
|
||
public function getSize(): Size | ||
{ | ||
return $this->size; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the `liip/LiipImagineBundle` project. | ||
* | ||
* (c) https://github.com/liip/LiipImagineBundle/graphs/contributors | ||
* | ||
* For the full copyright and license information, please view the LICENSE.md | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Liip\ImagineBundle\Config\Filter\Type; | ||
|
||
use Liip\ImagineBundle\Config\Filter\Argument\Size; | ||
|
||
/** | ||
* @codeCoverageIgnore | ||
*/ | ||
final class Downscale extends FilterAbstract | ||
{ | ||
const NAME = 'downscale'; | ||
|
||
/** | ||
* @var Size | ||
*/ | ||
private $max; | ||
|
||
/** | ||
* @var float | ||
*/ | ||
private $by; | ||
|
||
/** | ||
* @param Size|null $max | ||
* @param float|null $by sets the "ratio multiple" which initiates a proportional scale operation computed by multiplying all image sides by this value | ||
*/ | ||
public function __construct(Size $max = null, float $by = null) | ||
{ | ||
$this->max = $max; | ||
$this->by = $by; | ||
} | ||
|
||
public function getMax(): ?Size | ||
{ | ||
return $this->max; | ||
} | ||
|
||
public function getBy(): ?float | ||
{ | ||
return $this->by; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the `liip/LiipImagineBundle` project. | ||
* | ||
* (c) https://github.com/liip/LiipImagineBundle/graphs/contributors | ||
* | ||
* For the full copyright and license information, please view the LICENSE.md | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Liip\ImagineBundle\Config\Filter\Type; | ||
|
||
use Liip\ImagineBundle\Config\FilterInterface; | ||
|
||
/** | ||
* @codeCoverageIgnore | ||
*/ | ||
abstract class FilterAbstract implements FilterInterface | ||
{ | ||
public function getName(): string | ||
{ | ||
if (!defined('static::NAME')) { | ||
throw new \Exception('Constant NAME is not defined on subclass '.get_class($this)); | ||
} | ||
|
||
return static::NAME; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the `liip/LiipImagineBundle` project. | ||
* | ||
* (c) https://github.com/liip/LiipImagineBundle/graphs/contributors | ||
* | ||
* For the full copyright and license information, please view the LICENSE.md | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Liip\ImagineBundle\Config\Filter\Type; | ||
|
||
/** | ||
* @codeCoverageIgnore | ||
*/ | ||
final class Flip extends FilterAbstract | ||
{ | ||
const NAME = 'flip'; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $axis; | ||
|
||
/** | ||
* @param string $axis possible values are: "x", "horizontal", "y", or "vertical" | ||
*/ | ||
public function __construct(string $axis) | ||
{ | ||
$this->axis = $axis; | ||
} | ||
|
||
public function getAxis(): string | ||
{ | ||
return $this->axis; | ||
} | ||
} |
Oops, something went wrong.