-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrenderer-common.php
57 lines (51 loc) · 2.05 KB
/
renderer-common.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
50
51
52
53
54
55
56
57
<?php
use Xi\Filelib\Authorization\Adapter\SimpleAuthorizationAdapter;
use Xi\Filelib\Authorization\AuthorizationPlugin;
use Xi\Filelib\Plugin\Image\VersionPlugin;
use Xi\Filelib\Plugin\VersionProvider\OriginalVersionPlugin;
use Xi\Filelib\Publisher\Adapter\Filesystem\SymlinkFilesystemPublisherAdapter;
use Xi\Filelib\Publisher\Linker\BeautifurlLinker;
use Xi\Filelib\Publisher\Publisher;
use Xi\Filelib\Tool\Slugifier\Slugifier;
$AuthorizationAdapter = new SimpleAuthorizationAdapter();
$AuthorizationPlugin = new AuthorizationPlugin($AuthorizationAdapter);
$filelib->addPlugin($AuthorizationPlugin, array('default'));
$AuthorizationAdapter
->setFolderWritable(true)
->setFileReadableByAnonymous(false)
->setFileReadable(true);
$publisher = new Publisher(
new SymlinkFilesystemPublisherAdapter(__DIR__ . '/web/files', '600', '700', 'files'),
new BeautifurlLinker(
new Slugifier()
)
);
$publisher->attachTo($filelib);
$originalPlugin = new OriginalVersionPlugin('original');
$filelib->addPlugin($originalPlugin);
$versionPlugin = new VersionPlugin(
array(
'cinemascope' => array(
array(
array('setImageCompression',Imagick::COMPRESSION_JPEG),
array('setImageFormat', 'jpg'),
array('setImageCompressionQuality', 50),
array('cropThumbnailImage', array(800, 200)),
array('sepiaToneImage', 90),
'Xi\Filelib\Plugin\Image\Command\WatermarkCommand' => array(__DIR__ . '/watermark.png', 'se', 10),
),
'image/jpeg'
),
'croppo' => array(
array(
array('setImageCompression',Imagick::COMPRESSION_JPEG),
array('setImageFormat', 'jpg'),
array('setImageCompressionQuality', 20),
array('cropThumbnailImage', array(400, 400)),
'Xi\Filelib\Plugin\Image\Command\WatermarkCommand' => array(__DIR__ . '/watermark.png', 'nw', 5),
),
'image/jpeg'
)
)
);
$filelib->addPlugin($versionPlugin);