/
ThumbnailGenerated.php
49 lines (41 loc) · 1.26 KB
/
ThumbnailGenerated.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
namespace Concrete\Core\Notification\Events\ServerEvent;
use Concrete\Core\Entity\File\Version as FileVersion;
use Concrete\Core\File\Image\Thumbnail\Type\Version as ThumbnailTypeVersion;
class ThumbnailGenerated implements EventInterface
{
/**
* @var FileVersion
*/
protected $fileVersion;
/**
* @var ThumbnailTypeVersion
*/
protected $thumbnailTypeVersion;
/**
* @param FileVersion $fileVersion
* @param ThumbnailTypeVersion $thumbnailTypeVersion
*/
public function __construct(
FileVersion $fileVersion,
ThumbnailTypeVersion $thumbnailTypeVersion
)
{
$this->fileVersion = $fileVersion;
$this->thumbnailTypeVersion = $thumbnailTypeVersion;
}
public function getEvent(): string
{
return 'ThumbnailGenerated';
}
public function getData(): array
{
return [
'fileId' => $this->fileVersion->getFileID(),
'fileVersionId' => $this->fileVersion->getFileVersionID(),
'thumbnailTypeHandle' => $this->thumbnailTypeVersion->getHandle(),
'fileName' => $this->fileVersion->getFileName(),
'thumbnailUrl' => $this->fileVersion->getThumbnailURL($this->thumbnailTypeVersion)
];
}
}