-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge #5 branch feature/event-listener into develop
- Loading branch information
Showing
7 changed files
with
304 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Contao. | ||
* | ||
* Copyright (c) 2005-2016 Leo Feyer | ||
* | ||
* @license LGPL-3.0+ | ||
*/ | ||
|
||
namespace Contao\Image\Event; | ||
|
||
/** | ||
* Defines constants for the Contao image events. | ||
* | ||
* @author Leo Feyer <https://github.com/leofeyer> | ||
*/ | ||
final class ContaoImageEvents | ||
{ | ||
/** | ||
* The contao.image.resize_image event is triggered when an image is resized. | ||
* | ||
* @var string | ||
* | ||
* @see Contao\Image\Event\ResizeImageEvent | ||
*/ | ||
const RESIZE_IMAGE = 'contao.image.resize_image'; | ||
} |
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,128 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Contao. | ||
* | ||
* Copyright (c) 2005-2016 Leo Feyer | ||
* | ||
* @license LGPL-3.0+ | ||
*/ | ||
|
||
namespace Contao\Image\Event; | ||
|
||
use Contao\Image\ImageInterface; | ||
use Contao\Image\ResizeCoordinatesInterface; | ||
use Symfony\Component\EventDispatcher\Event; | ||
|
||
/** | ||
* Allows to set a resized image. | ||
* | ||
* @author Leo Feyer <https://github.com/leofeyer> | ||
*/ | ||
class ResizeImageEvent extends Event | ||
{ | ||
/** | ||
* @var ImageInterface | ||
*/ | ||
private $image; | ||
|
||
/** | ||
* @var ResizeCoordinatesInterface | ||
*/ | ||
private $coordinates; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $path; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
private $imagineOptions; | ||
|
||
/** | ||
* @var ImageInterface | ||
*/ | ||
private $resizedImage; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param ImageInterface $image | ||
* @param ResizeCoordinatesInterface $coordinates | ||
* @param string $path | ||
* @param array $imagineOptions | ||
*/ | ||
public function __construct( | ||
ImageInterface $image, | ||
ResizeCoordinatesInterface $coordinates, | ||
$path, | ||
array $imagineOptions | ||
) { | ||
$this->image = $image; | ||
$this->coordinates = $coordinates; | ||
$this->path = $path; | ||
$this->imagineOptions = $imagineOptions; | ||
} | ||
|
||
/** | ||
* Returns the image object. | ||
* | ||
* @return ImageInterface | ||
*/ | ||
public function getImage() | ||
{ | ||
return $this->image; | ||
} | ||
|
||
/** | ||
* Returns the coordinates object. | ||
* | ||
* @return ResizeCoordinatesInterface | ||
*/ | ||
public function getCoordinates() | ||
{ | ||
return $this->coordinates; | ||
} | ||
|
||
/** | ||
* Returns the path. | ||
* | ||
* @return string | ||
*/ | ||
public function getPath() | ||
{ | ||
return $this->path; | ||
} | ||
|
||
/** | ||
* Returns the Imagine options. | ||
* | ||
* @return array | ||
*/ | ||
public function getImagineOptions() | ||
{ | ||
return $this->imagineOptions; | ||
} | ||
|
||
/** | ||
* Returns the resized image. | ||
* | ||
* @return ImageInterface | ||
*/ | ||
public function getResizedImage() | ||
{ | ||
return $this->resizedImage; | ||
} | ||
|
||
/** | ||
* Sets the resized image. | ||
* | ||
* @param ImageInterface|null $image | ||
*/ | ||
public function setResizedImage(ImageInterface $image = null) | ||
{ | ||
$this->resizedImage = $image; | ||
} | ||
} |
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
Oops, something went wrong.