@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | $tca = [ |
13 | 13 | 'types' => [ |
14 | - 0 => ['showitem' => $GLOBALS['TCA']['sys_file_storage']['types'][0]['showitem'] . ', |
|
14 | + 0 => ['showitem' => $GLOBALS['TCA']['sys_file_storage']['types'][0]['showitem'].', |
|
15 | 15 | |
16 | 16 | --div--;LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:tab.upload_settings, |
17 | 17 | maximum_dimension_original_image, extension_allowed_file_type_1, extension_allowed_file_type_2, extension_allowed_file_type_3, extension_allowed_file_type_4, extension_allowed_file_type_5, |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $tcaForHiddenFolderTree = [ |
82 | 82 | |
83 | 83 | 'types' => [ |
84 | - 0 => ['showitem' => $GLOBALS['TCA']['sys_file_storage']['types'][0]['showitem'] . ', |
|
84 | + 0 => ['showitem' => $GLOBALS['TCA']['sys_file_storage']['types'][0]['showitem'].', |
|
85 | 85 | |
86 | 86 | --div--;LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:tab.media_mount_point, |
87 | 87 | mount_point_file_type_1, mount_point_file_type_2, mount_point_file_type_3, mount_point_file_type_4, mount_point_file_type_5, |
@@ -2,82 +2,82 @@ discard block |
||
2 | 2 | if (!defined('TYPO3_MODE')) die ('Access denied.'); |
3 | 3 | |
4 | 4 | $configuration = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
5 | - TYPO3\CMS\Core\Configuration\ExtensionConfiguration::class |
|
5 | + TYPO3\CMS\Core\Configuration\ExtensionConfiguration::class |
|
6 | 6 | )->get('media'); |
7 | 7 | |
8 | 8 | $tca = [ |
9 | - 'types' => [ |
|
10 | - 0 => ['showitem' => $GLOBALS['TCA']['sys_file_storage']['types'][0]['showitem'] . ', |
|
9 | + 'types' => [ |
|
10 | + 0 => ['showitem' => $GLOBALS['TCA']['sys_file_storage']['types'][0]['showitem'] . ', |
|
11 | 11 | |
12 | 12 | --div--;LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:tab.upload_settings, |
13 | 13 | maximum_dimension_original_image, extension_allowed_file_type_1, extension_allowed_file_type_2, extension_allowed_file_type_3, extension_allowed_file_type_4, extension_allowed_file_type_5, |
14 | 14 | ', |
15 | - ], |
|
16 | - ], |
|
17 | - 'columns' => [ |
|
18 | - 'maximum_dimension_original_image' => [ |
|
19 | - 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.maximum_dimension_original_image', |
|
20 | - 'config' => [ |
|
21 | - 'type' => 'input', |
|
22 | - 'size' => 24, |
|
23 | - 'default' => '1920x1920', |
|
24 | - 'eval' => 'trim', |
|
25 | - ], |
|
26 | - ], |
|
27 | - 'extension_allowed_file_type_1' => [ |
|
28 | - 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.extension_allowed_file_type_1', |
|
29 | - 'config' => [ |
|
30 | - 'type' => 'input', |
|
31 | - 'size' => 255, |
|
32 | - 'default' => 'txt, html', |
|
33 | - 'eval' => 'trim', |
|
34 | - ], |
|
35 | - ], |
|
36 | - 'extension_allowed_file_type_2' => [ |
|
37 | - 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.extension_allowed_file_type_2', |
|
38 | - 'config' => [ |
|
39 | - 'type' => 'input', |
|
40 | - 'size' => 255, |
|
41 | - 'default' => 'jpg, jpeg, bmp, png, tiff, tif, gif, eps', |
|
42 | - 'eval' => 'trim', |
|
43 | - ], |
|
44 | - ], |
|
45 | - 'extension_allowed_file_type_3' => [ |
|
46 | - 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.extension_allowed_file_type_3', |
|
47 | - 'config' => [ |
|
48 | - 'type' => 'input', |
|
49 | - 'size' => 255, |
|
50 | - 'default' => 'mp3, mp4, m4a, wma, f4a', |
|
51 | - 'eval' => 'trim', |
|
52 | - ], |
|
53 | - ], |
|
54 | - 'extension_allowed_file_type_4' => [ |
|
55 | - 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.extension_allowed_file_type_4', |
|
56 | - 'config' => [ |
|
57 | - 'type' => 'input', |
|
58 | - 'size' => 255, |
|
59 | - 'default' => 'mov, avi, mpeg, mpg, mp4, m4v, flv, f4v, webm, wmv, ogv, 3gp', |
|
60 | - 'eval' => 'trim', |
|
61 | - ], |
|
62 | - ], |
|
63 | - 'extension_allowed_file_type_5' => [ |
|
64 | - 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.extension_allowed_file_type_5', |
|
65 | - 'config' => [ |
|
66 | - 'type' => 'input', |
|
67 | - 'size' => 255, |
|
68 | - 'default' => 'pdf, zip, doc, docx, dotx, ppt, pptx, pps, ppsx, odt, xls, xlsx, xltx, rtf, xlt', |
|
69 | - 'eval' => 'trim', |
|
70 | - ], |
|
71 | - ], |
|
72 | - ], |
|
15 | + ], |
|
16 | + ], |
|
17 | + 'columns' => [ |
|
18 | + 'maximum_dimension_original_image' => [ |
|
19 | + 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.maximum_dimension_original_image', |
|
20 | + 'config' => [ |
|
21 | + 'type' => 'input', |
|
22 | + 'size' => 24, |
|
23 | + 'default' => '1920x1920', |
|
24 | + 'eval' => 'trim', |
|
25 | + ], |
|
26 | + ], |
|
27 | + 'extension_allowed_file_type_1' => [ |
|
28 | + 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.extension_allowed_file_type_1', |
|
29 | + 'config' => [ |
|
30 | + 'type' => 'input', |
|
31 | + 'size' => 255, |
|
32 | + 'default' => 'txt, html', |
|
33 | + 'eval' => 'trim', |
|
34 | + ], |
|
35 | + ], |
|
36 | + 'extension_allowed_file_type_2' => [ |
|
37 | + 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.extension_allowed_file_type_2', |
|
38 | + 'config' => [ |
|
39 | + 'type' => 'input', |
|
40 | + 'size' => 255, |
|
41 | + 'default' => 'jpg, jpeg, bmp, png, tiff, tif, gif, eps', |
|
42 | + 'eval' => 'trim', |
|
43 | + ], |
|
44 | + ], |
|
45 | + 'extension_allowed_file_type_3' => [ |
|
46 | + 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.extension_allowed_file_type_3', |
|
47 | + 'config' => [ |
|
48 | + 'type' => 'input', |
|
49 | + 'size' => 255, |
|
50 | + 'default' => 'mp3, mp4, m4a, wma, f4a', |
|
51 | + 'eval' => 'trim', |
|
52 | + ], |
|
53 | + ], |
|
54 | + 'extension_allowed_file_type_4' => [ |
|
55 | + 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.extension_allowed_file_type_4', |
|
56 | + 'config' => [ |
|
57 | + 'type' => 'input', |
|
58 | + 'size' => 255, |
|
59 | + 'default' => 'mov, avi, mpeg, mpg, mp4, m4v, flv, f4v, webm, wmv, ogv, 3gp', |
|
60 | + 'eval' => 'trim', |
|
61 | + ], |
|
62 | + ], |
|
63 | + 'extension_allowed_file_type_5' => [ |
|
64 | + 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.extension_allowed_file_type_5', |
|
65 | + 'config' => [ |
|
66 | + 'type' => 'input', |
|
67 | + 'size' => 255, |
|
68 | + 'default' => 'pdf, zip, doc, docx, dotx, ppt, pptx, pps, ppsx, odt, xls, xlsx, xltx, rtf, xlt', |
|
69 | + 'eval' => 'trim', |
|
70 | + ], |
|
71 | + ], |
|
72 | + ], |
|
73 | 73 | ]; |
74 | 74 | |
75 | 75 | $tcaForHiddenFolderTree = []; |
76 | 76 | if (!$configuration['has_folder_tree']) { |
77 | - $tcaForHiddenFolderTree = [ |
|
77 | + $tcaForHiddenFolderTree = [ |
|
78 | 78 | |
79 | - 'types' => [ |
|
80 | - 0 => ['showitem' => $GLOBALS['TCA']['sys_file_storage']['types'][0]['showitem'] . ', |
|
79 | + 'types' => [ |
|
80 | + 0 => ['showitem' => $GLOBALS['TCA']['sys_file_storage']['types'][0]['showitem'] . ', |
|
81 | 81 | |
82 | 82 | --div--;LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:tab.media_mount_point, |
83 | 83 | mount_point_file_type_1, mount_point_file_type_2, mount_point_file_type_3, mount_point_file_type_4, mount_point_file_type_5, |
@@ -86,126 +86,126 @@ discard block |
||
86 | 86 | maximum_dimension_original_image, extension_allowed_file_type_1, extension_allowed_file_type_2, extension_allowed_file_type_3, extension_allowed_file_type_4, extension_allowed_file_type_5, |
87 | 87 | ', |
88 | 88 | |
89 | - ], |
|
90 | - ], |
|
91 | - 'columns' => [ |
|
92 | - 'mount_point_file_type_1' => [ |
|
93 | - 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.mount_point_file_type_1', |
|
94 | - 'config' => [ |
|
95 | - 'type' => 'group', |
|
96 | - 'internal_type' => 'db', |
|
97 | - 'allowed' => 'sys_filemounts', |
|
98 | - 'size' => 1, |
|
99 | - 'minitems' => 0, |
|
100 | - 'maxitems' => 1, |
|
101 | - 'wizards' => [ |
|
102 | - 'edit' => [ |
|
103 | - 'type' => 'popup', |
|
104 | - 'module' => [ |
|
105 | - 'name' => 'wizard_edit', |
|
106 | - ], |
|
107 | - 'icon' => 'edit2.gif', |
|
108 | - 'popup_onlyOpenIfSelected' => 1, |
|
109 | - 'notNewRecords' => 1, |
|
110 | - 'JSopenParams' => 'height=500,width=800,status=0,menubar=0,scrollbars=1,resizable=yes' |
|
111 | - ], |
|
112 | - ], |
|
113 | - ], |
|
114 | - ], |
|
115 | - 'mount_point_file_type_2' => [ |
|
116 | - 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.mount_point_file_type_2', |
|
117 | - 'config' => [ |
|
118 | - 'type' => 'group', |
|
119 | - 'internal_type' => 'db', |
|
120 | - 'allowed' => 'sys_filemounts', |
|
121 | - 'size' => 1, |
|
122 | - 'minitems' => 0, |
|
123 | - 'maxitems' => 1, |
|
124 | - 'wizards' => [ |
|
125 | - 'edit' => [ |
|
126 | - 'type' => 'popup', |
|
127 | - 'module' => [ |
|
128 | - 'name' => 'wizard_edit', |
|
129 | - ], |
|
130 | - 'icon' => 'edit2.gif', |
|
131 | - 'popup_onlyOpenIfSelected' => 1, |
|
132 | - 'notNewRecords' => 1, |
|
133 | - 'JSopenParams' => 'height=500,width=800,status=0,menubar=0,scrollbars=1,resizable=yes' |
|
134 | - ], |
|
135 | - ], |
|
136 | - ], |
|
137 | - ], |
|
138 | - 'mount_point_file_type_3' => [ |
|
139 | - 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.mount_point_file_type_3', |
|
140 | - 'config' => [ |
|
141 | - 'type' => 'group', |
|
142 | - 'internal_type' => 'db', |
|
143 | - 'allowed' => 'sys_filemounts', |
|
144 | - 'size' => 1, |
|
145 | - 'minitems' => 0, |
|
146 | - 'maxitems' => 1, |
|
147 | - 'wizards' => [ |
|
148 | - 'edit' => [ |
|
149 | - 'type' => 'popup', |
|
150 | - 'module' => [ |
|
151 | - 'name' => 'wizard_edit', |
|
152 | - ], |
|
153 | - 'icon' => 'edit2.gif', |
|
154 | - 'popup_onlyOpenIfSelected' => 1, |
|
155 | - 'notNewRecords' => 1, |
|
156 | - 'JSopenParams' => 'height=500,width=800,status=0,menubar=0,scrollbars=1,resizable=yes' |
|
157 | - ], |
|
158 | - ], |
|
159 | - ], |
|
160 | - ], |
|
161 | - 'mount_point_file_type_4' => [ |
|
162 | - 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.mount_point_file_type_4', |
|
163 | - 'config' => [ |
|
164 | - 'type' => 'group', |
|
165 | - 'internal_type' => 'db', |
|
166 | - 'allowed' => 'sys_filemounts', |
|
167 | - 'size' => 1, |
|
168 | - 'minitems' => 0, |
|
169 | - 'maxitems' => 1, |
|
170 | - 'wizards' => [ |
|
171 | - 'edit' => [ |
|
172 | - 'type' => 'popup', |
|
173 | - 'module' => [ |
|
174 | - 'name' => 'wizard_edit', |
|
175 | - ], |
|
176 | - 'icon' => 'edit2.gif', |
|
177 | - 'popup_onlyOpenIfSelected' => 1, |
|
178 | - 'notNewRecords' => 1, |
|
179 | - 'JSopenParams' => 'height=500,width=800,status=0,menubar=0,scrollbars=1,resizable=yes' |
|
180 | - ], |
|
181 | - ], |
|
182 | - ], |
|
183 | - ], |
|
184 | - 'mount_point_file_type_5' => [ |
|
185 | - 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.mount_point_file_type_5', |
|
186 | - 'config' => [ |
|
187 | - 'type' => 'group', |
|
188 | - 'internal_type' => 'db', |
|
189 | - 'allowed' => 'sys_filemounts', |
|
190 | - 'size' => 1, |
|
191 | - 'minitems' => 0, |
|
192 | - 'maxitems' => 1, |
|
193 | - 'wizards' => [ |
|
194 | - 'edit' => [ |
|
195 | - 'type' => 'popup', |
|
196 | - 'module' => [ |
|
197 | - 'name' => 'wizard_edit', |
|
198 | - ], |
|
199 | - 'icon' => 'edit2.gif', |
|
200 | - 'popup_onlyOpenIfSelected' => 1, |
|
201 | - 'notNewRecords' => 1, |
|
202 | - 'JSopenParams' => 'height=500,width=800,status=0,menubar=0,scrollbars=1,resizable=yes' |
|
203 | - ], |
|
204 | - ], |
|
205 | - ], |
|
206 | - ], |
|
207 | - ], |
|
208 | - ]; |
|
89 | + ], |
|
90 | + ], |
|
91 | + 'columns' => [ |
|
92 | + 'mount_point_file_type_1' => [ |
|
93 | + 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.mount_point_file_type_1', |
|
94 | + 'config' => [ |
|
95 | + 'type' => 'group', |
|
96 | + 'internal_type' => 'db', |
|
97 | + 'allowed' => 'sys_filemounts', |
|
98 | + 'size' => 1, |
|
99 | + 'minitems' => 0, |
|
100 | + 'maxitems' => 1, |
|
101 | + 'wizards' => [ |
|
102 | + 'edit' => [ |
|
103 | + 'type' => 'popup', |
|
104 | + 'module' => [ |
|
105 | + 'name' => 'wizard_edit', |
|
106 | + ], |
|
107 | + 'icon' => 'edit2.gif', |
|
108 | + 'popup_onlyOpenIfSelected' => 1, |
|
109 | + 'notNewRecords' => 1, |
|
110 | + 'JSopenParams' => 'height=500,width=800,status=0,menubar=0,scrollbars=1,resizable=yes' |
|
111 | + ], |
|
112 | + ], |
|
113 | + ], |
|
114 | + ], |
|
115 | + 'mount_point_file_type_2' => [ |
|
116 | + 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.mount_point_file_type_2', |
|
117 | + 'config' => [ |
|
118 | + 'type' => 'group', |
|
119 | + 'internal_type' => 'db', |
|
120 | + 'allowed' => 'sys_filemounts', |
|
121 | + 'size' => 1, |
|
122 | + 'minitems' => 0, |
|
123 | + 'maxitems' => 1, |
|
124 | + 'wizards' => [ |
|
125 | + 'edit' => [ |
|
126 | + 'type' => 'popup', |
|
127 | + 'module' => [ |
|
128 | + 'name' => 'wizard_edit', |
|
129 | + ], |
|
130 | + 'icon' => 'edit2.gif', |
|
131 | + 'popup_onlyOpenIfSelected' => 1, |
|
132 | + 'notNewRecords' => 1, |
|
133 | + 'JSopenParams' => 'height=500,width=800,status=0,menubar=0,scrollbars=1,resizable=yes' |
|
134 | + ], |
|
135 | + ], |
|
136 | + ], |
|
137 | + ], |
|
138 | + 'mount_point_file_type_3' => [ |
|
139 | + 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.mount_point_file_type_3', |
|
140 | + 'config' => [ |
|
141 | + 'type' => 'group', |
|
142 | + 'internal_type' => 'db', |
|
143 | + 'allowed' => 'sys_filemounts', |
|
144 | + 'size' => 1, |
|
145 | + 'minitems' => 0, |
|
146 | + 'maxitems' => 1, |
|
147 | + 'wizards' => [ |
|
148 | + 'edit' => [ |
|
149 | + 'type' => 'popup', |
|
150 | + 'module' => [ |
|
151 | + 'name' => 'wizard_edit', |
|
152 | + ], |
|
153 | + 'icon' => 'edit2.gif', |
|
154 | + 'popup_onlyOpenIfSelected' => 1, |
|
155 | + 'notNewRecords' => 1, |
|
156 | + 'JSopenParams' => 'height=500,width=800,status=0,menubar=0,scrollbars=1,resizable=yes' |
|
157 | + ], |
|
158 | + ], |
|
159 | + ], |
|
160 | + ], |
|
161 | + 'mount_point_file_type_4' => [ |
|
162 | + 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.mount_point_file_type_4', |
|
163 | + 'config' => [ |
|
164 | + 'type' => 'group', |
|
165 | + 'internal_type' => 'db', |
|
166 | + 'allowed' => 'sys_filemounts', |
|
167 | + 'size' => 1, |
|
168 | + 'minitems' => 0, |
|
169 | + 'maxitems' => 1, |
|
170 | + 'wizards' => [ |
|
171 | + 'edit' => [ |
|
172 | + 'type' => 'popup', |
|
173 | + 'module' => [ |
|
174 | + 'name' => 'wizard_edit', |
|
175 | + ], |
|
176 | + 'icon' => 'edit2.gif', |
|
177 | + 'popup_onlyOpenIfSelected' => 1, |
|
178 | + 'notNewRecords' => 1, |
|
179 | + 'JSopenParams' => 'height=500,width=800,status=0,menubar=0,scrollbars=1,resizable=yes' |
|
180 | + ], |
|
181 | + ], |
|
182 | + ], |
|
183 | + ], |
|
184 | + 'mount_point_file_type_5' => [ |
|
185 | + 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.mount_point_file_type_5', |
|
186 | + 'config' => [ |
|
187 | + 'type' => 'group', |
|
188 | + 'internal_type' => 'db', |
|
189 | + 'allowed' => 'sys_filemounts', |
|
190 | + 'size' => 1, |
|
191 | + 'minitems' => 0, |
|
192 | + 'maxitems' => 1, |
|
193 | + 'wizards' => [ |
|
194 | + 'edit' => [ |
|
195 | + 'type' => 'popup', |
|
196 | + 'module' => [ |
|
197 | + 'name' => 'wizard_edit', |
|
198 | + ], |
|
199 | + 'icon' => 'edit2.gif', |
|
200 | + 'popup_onlyOpenIfSelected' => 1, |
|
201 | + 'notNewRecords' => 1, |
|
202 | + 'JSopenParams' => 'height=500,width=800,status=0,menubar=0,scrollbars=1,resizable=yes' |
|
203 | + ], |
|
204 | + ], |
|
205 | + ], |
|
206 | + ], |
|
207 | + ], |
|
208 | + ]; |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | // Merge first two possible TCA whether the folder tree is displayed or not. |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if (!defined('TYPO3_MODE')) die ('Access denied.'); |
|
2 | +if (!defined('TYPO3_MODE')) { |
|
3 | + die ('Access denied.'); |
|
4 | +} |
|
3 | 5 | |
4 | 6 | $configuration = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
5 | 7 | TYPO3\CMS\Core\Configuration\ExtensionConfiguration::class |
@@ -15,48 +15,48 @@ |
||
15 | 15 | class FallBackThumbnailProcessor extends AbstractThumbnailProcessor |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * Render a fallback thumbnail if no type was found for the given resource. |
|
20 | - * |
|
21 | - * @return string |
|
22 | - */ |
|
23 | - public function create() |
|
24 | - { |
|
25 | - return sprintf( |
|
26 | - '<img src="%s" hspace="2" class="" alt="" />', |
|
27 | - Path::getRelativePath('Icons/UnknownMimeType.png') |
|
28 | - ); |
|
29 | - } |
|
18 | + /** |
|
19 | + * Render a fallback thumbnail if no type was found for the given resource. |
|
20 | + * |
|
21 | + * @return string |
|
22 | + */ |
|
23 | + public function create() |
|
24 | + { |
|
25 | + return sprintf( |
|
26 | + '<img src="%s" hspace="2" class="" alt="" />', |
|
27 | + Path::getRelativePath('Icons/UnknownMimeType.png') |
|
28 | + ); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Render the URI of the thumbnail. |
|
33 | - * |
|
34 | - * @return string |
|
35 | - */ |
|
36 | - public function renderUri() |
|
37 | - { |
|
38 | - // Nothing to implement. |
|
39 | - } |
|
31 | + /** |
|
32 | + * Render the URI of the thumbnail. |
|
33 | + * |
|
34 | + * @return string |
|
35 | + */ |
|
36 | + public function renderUri() |
|
37 | + { |
|
38 | + // Nothing to implement. |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
42 | - * Render the tag image which is the main one for a thumbnail. |
|
43 | - * |
|
44 | - * @param string $result |
|
45 | - * @return string |
|
46 | - */ |
|
47 | - public function renderTagImage($result) |
|
48 | - { |
|
49 | - // Nothing to implement. |
|
50 | - } |
|
41 | + /** |
|
42 | + * Render the tag image which is the main one for a thumbnail. |
|
43 | + * |
|
44 | + * @param string $result |
|
45 | + * @return string |
|
46 | + */ |
|
47 | + public function renderTagImage($result) |
|
48 | + { |
|
49 | + // Nothing to implement. |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * Render a wrapping anchor around the thumbnail. |
|
54 | - * |
|
55 | - * @param string $result |
|
56 | - * @return string |
|
57 | - */ |
|
58 | - public function renderTagAnchor($result) |
|
59 | - { |
|
60 | - // Nothing to implement. |
|
61 | - } |
|
52 | + /** |
|
53 | + * Render a wrapping anchor around the thumbnail. |
|
54 | + * |
|
55 | + * @param string $result |
|
56 | + * @return string |
|
57 | + */ |
|
58 | + public function renderTagAnchor($result) |
|
59 | + { |
|
60 | + // Nothing to implement. |
|
61 | + } |
|
62 | 62 | } |
@@ -20,313 +20,313 @@ |
||
20 | 20 | class ThumbnailService |
21 | 21 | { |
22 | 22 | |
23 | - /** |
|
24 | - * @var array |
|
25 | - */ |
|
26 | - protected $allowedOutputTypes = array( |
|
27 | - ThumbnailInterface::OUTPUT_IMAGE, |
|
28 | - ThumbnailInterface::OUTPUT_IMAGE_WRAPPED, |
|
29 | - ThumbnailInterface::OUTPUT_URI, |
|
30 | - ); |
|
31 | - |
|
32 | - /** |
|
33 | - * Configure the output of the thumbnail service whether it is wrapped or not. |
|
34 | - * Default output is: ThumbnailInterface::OUTPUT_IMAGE |
|
35 | - * |
|
36 | - * @var string |
|
37 | - */ |
|
38 | - protected $outputType = ThumbnailInterface::OUTPUT_IMAGE; |
|
39 | - |
|
40 | - /** |
|
41 | - * @var File |
|
42 | - */ |
|
43 | - protected $file; |
|
44 | - |
|
45 | - /** |
|
46 | - * Define width, height and all sort of attributes to render a thumbnail. |
|
47 | - * @see TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::Image |
|
48 | - * @var array |
|
49 | - */ |
|
50 | - protected $configuration = []; |
|
51 | - |
|
52 | - /** |
|
53 | - * Define width, height and all sort of attributes to render the anchor file |
|
54 | - * which is wrapping the image |
|
55 | - * |
|
56 | - * @see TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::Image |
|
57 | - * @var array |
|
58 | - */ |
|
59 | - protected $configurationWrap = []; |
|
60 | - |
|
61 | - /** |
|
62 | - * DOM attributes to add to the image preview. |
|
63 | - * |
|
64 | - * @var array |
|
65 | - */ |
|
66 | - protected $attributes = [ |
|
67 | - 'class' => 'thumbnail', |
|
68 | - ]; |
|
69 | - |
|
70 | - /** |
|
71 | - * Define in which window will the thumbnail be opened. |
|
72 | - * Does only apply if the thumbnail is wrapped (with an anchor). |
|
73 | - * |
|
74 | - * @var string |
|
75 | - */ |
|
76 | - protected $target = ThumbnailInterface::TARGET_BLANK; |
|
77 | - |
|
78 | - /** |
|
79 | - * URI of the wrapping anchor pointing to the file. |
|
80 | - * replacing the "?" <a href="?">...</a> |
|
81 | - * The URI is automatically computed if not set. |
|
82 | - * @var string |
|
83 | - */ |
|
84 | - protected $anchorUri; |
|
85 | - |
|
86 | - /** |
|
87 | - * Whether a time stamp is appended to the image. |
|
88 | - * Appending the time stamp can prevent caching |
|
89 | - * |
|
90 | - * @var bool |
|
91 | - */ |
|
92 | - protected $appendTimeStamp = false; |
|
93 | - |
|
94 | - /** |
|
95 | - * Define the processing type for the thumbnail. |
|
96 | - * As instance for image the default is ProcessedFile::CONTEXT_IMAGECROPSCALEMASK. |
|
97 | - * |
|
98 | - * @var string |
|
99 | - */ |
|
100 | - protected $processingType; |
|
101 | - |
|
102 | - /** |
|
103 | - * Constructor |
|
104 | - * |
|
105 | - * @param File $file |
|
106 | - */ |
|
107 | - public function __construct(File $file = null) |
|
108 | - { |
|
109 | - $this->file = $file; |
|
110 | - } |
|
111 | - |
|
112 | - /** |
|
113 | - * Render a thumbnail of a media |
|
114 | - * |
|
115 | - * @throws MissingTcaConfigurationException |
|
116 | - * @return string |
|
117 | - * @throws \InvalidArgumentException |
|
118 | - */ |
|
119 | - public function create() |
|
120 | - { |
|
121 | - |
|
122 | - if (!$this->file) { |
|
123 | - throw new MissingTcaConfigurationException('Missing File object. Forgotten to set a file?', 1355933144); |
|
124 | - } |
|
125 | - |
|
126 | - // Default class name |
|
127 | - $className = 'Fab\Media\Thumbnail\FallBackThumbnailProcessor'; |
|
128 | - if (File::FILETYPE_IMAGE === $this->file->getType()) { |
|
129 | - $className = 'Fab\Media\Thumbnail\ImageThumbnailProcessor'; |
|
130 | - } elseif (File::FILETYPE_AUDIO === $this->file->getType()) { |
|
131 | - $className = 'Fab\Media\Thumbnail\AudioThumbnailProcessor'; |
|
132 | - } elseif (File::FILETYPE_VIDEO === $this->file->getType()) { |
|
133 | - $className = 'Fab\Media\Thumbnail\VideoThumbnailProcessor'; |
|
134 | - } elseif (File::FILETYPE_APPLICATION === $this->file->getType() || File::FILETYPE_TEXT === $this->file->getType()) { |
|
135 | - $className = 'Fab\Media\Thumbnail\ApplicationThumbnailProcessor'; |
|
136 | - } |
|
137 | - |
|
138 | - /** @var $processorInstance \Fab\Media\Thumbnail\ThumbnailProcessorInterface */ |
|
139 | - $processorInstance = GeneralUtility::makeInstance($className); |
|
140 | - |
|
141 | - $thumbnail = ''; |
|
142 | - if ($this->file->exists()) { |
|
143 | - $thumbnail = $processorInstance->setThumbnailService($this)->create(); |
|
144 | - } else { |
|
145 | - $logger = Logger::getInstance($this); |
|
146 | - $logger->warning(sprintf('Resource not found for File uid "%s" at %s', $this->file->getUid(), $this->file->getIdentifier())); |
|
147 | - } |
|
148 | - |
|
149 | - return $thumbnail; |
|
150 | - } |
|
151 | - |
|
152 | - /** |
|
153 | - * @return array |
|
154 | - */ |
|
155 | - public function getConfigurationWrap() |
|
156 | - { |
|
157 | - return $this->configurationWrap; |
|
158 | - } |
|
159 | - |
|
160 | - /** |
|
161 | - * @param array $configurationWrap |
|
162 | - * @return $this |
|
163 | - */ |
|
164 | - public function setConfigurationWrap($configurationWrap) |
|
165 | - { |
|
166 | - $this->configurationWrap = $configurationWrap; |
|
167 | - return $this; |
|
168 | - } |
|
169 | - |
|
170 | - /** |
|
171 | - * @return mixed |
|
172 | - */ |
|
173 | - public function getFile() |
|
174 | - { |
|
175 | - return $this->file; |
|
176 | - } |
|
177 | - |
|
178 | - /** |
|
179 | - * @return array |
|
180 | - */ |
|
181 | - public function getConfiguration() |
|
182 | - { |
|
183 | - return $this->configuration; |
|
184 | - } |
|
185 | - |
|
186 | - /** |
|
187 | - * @param array|ThumbnailConfiguration $configuration |
|
188 | - * @return $this |
|
189 | - */ |
|
190 | - public function setConfiguration($configuration) |
|
191 | - { |
|
192 | - if ($configuration instanceof ThumbnailConfiguration) { |
|
193 | - $configurationObject = $configuration; |
|
194 | - $configuration = []; |
|
195 | - |
|
196 | - if ($configurationObject->getWidth() > 0) { |
|
197 | - $configuration['width'] = $configurationObject->getWidth(); |
|
198 | - } |
|
199 | - |
|
200 | - if ($configurationObject->getHeight() > 0) { |
|
201 | - $configuration['height'] = $configurationObject->getHeight(); |
|
202 | - } |
|
203 | - |
|
204 | - if ($configurationObject->getStyle()) { |
|
205 | - $this->attributes['style'] = $configurationObject->getStyle(); |
|
206 | - } |
|
207 | - |
|
208 | - if ($configurationObject->getClassName()) { |
|
209 | - $this->attributes['class'] = $configurationObject->getClassName(); |
|
210 | - } |
|
211 | - } |
|
212 | - |
|
213 | - $this->configuration = $configuration; |
|
214 | - return $this; |
|
215 | - } |
|
216 | - |
|
217 | - /** |
|
218 | - * @return array |
|
219 | - */ |
|
220 | - public function getAttributes() |
|
221 | - { |
|
222 | - return $this->attributes; |
|
223 | - } |
|
224 | - |
|
225 | - /** |
|
226 | - * @param array $attributes |
|
227 | - * @return $this |
|
228 | - */ |
|
229 | - public function setAttributes($attributes) |
|
230 | - { |
|
231 | - $this->attributes = $attributes; |
|
232 | - return $this; |
|
233 | - } |
|
234 | - |
|
235 | - /** |
|
236 | - * @return string |
|
237 | - */ |
|
238 | - public function getOutputType() |
|
239 | - { |
|
240 | - return $this->outputType; |
|
241 | - } |
|
242 | - |
|
243 | - /** |
|
244 | - * @throws InvalidKeyInArrayException |
|
245 | - * @param string $outputType |
|
246 | - * @return $this |
|
247 | - */ |
|
248 | - public function setOutputType($outputType) |
|
249 | - { |
|
250 | - if (!in_array($outputType, $this->allowedOutputTypes)) { |
|
251 | - throw new InvalidKeyInArrayException( |
|
252 | - sprintf('Output type "%s" is not allowed', $outputType), |
|
253 | - 1373020076 |
|
254 | - ); |
|
255 | - } |
|
256 | - $this->outputType = $outputType; |
|
257 | - return $this; |
|
258 | - } |
|
259 | - |
|
260 | - /** |
|
261 | - * @return string |
|
262 | - */ |
|
263 | - public function getTarget() |
|
264 | - { |
|
265 | - return $this->target; |
|
266 | - } |
|
267 | - |
|
268 | - /** |
|
269 | - * @param string $target |
|
270 | - * @return $this |
|
271 | - */ |
|
272 | - public function setTarget($target) |
|
273 | - { |
|
274 | - $this->target = $target; |
|
275 | - return $this; |
|
276 | - } |
|
277 | - |
|
278 | - /** |
|
279 | - * @return string |
|
280 | - */ |
|
281 | - public function getAnchorUri() |
|
282 | - { |
|
283 | - return $this->anchorUri; |
|
284 | - } |
|
285 | - |
|
286 | - /** |
|
287 | - * @param string $anchorUri |
|
288 | - * @return $this |
|
289 | - */ |
|
290 | - public function setAnchorUri($anchorUri) |
|
291 | - { |
|
292 | - $this->anchorUri = $anchorUri; |
|
293 | - return $this; |
|
294 | - } |
|
295 | - |
|
296 | - /** |
|
297 | - * @return boolean |
|
298 | - */ |
|
299 | - public function getAppendTimeStamp() |
|
300 | - { |
|
301 | - return $this->appendTimeStamp; |
|
302 | - } |
|
303 | - |
|
304 | - /** |
|
305 | - * @param boolean $appendTimeStamp |
|
306 | - * @return $this |
|
307 | - */ |
|
308 | - public function setAppendTimeStamp($appendTimeStamp) |
|
309 | - { |
|
310 | - $this->appendTimeStamp = (bool)$appendTimeStamp; |
|
311 | - return $this; |
|
312 | - } |
|
313 | - |
|
314 | - /** |
|
315 | - * @return string |
|
316 | - */ |
|
317 | - public function getProcessingType() |
|
318 | - { |
|
319 | - $this->processingType; |
|
320 | - } |
|
321 | - |
|
322 | - /** |
|
323 | - * @param string $processingType |
|
324 | - * @return $this |
|
325 | - */ |
|
326 | - public function setProcessingType($processingType) |
|
327 | - { |
|
328 | - $this->processingType = $processingType; |
|
329 | - return $this; |
|
330 | - } |
|
23 | + /** |
|
24 | + * @var array |
|
25 | + */ |
|
26 | + protected $allowedOutputTypes = array( |
|
27 | + ThumbnailInterface::OUTPUT_IMAGE, |
|
28 | + ThumbnailInterface::OUTPUT_IMAGE_WRAPPED, |
|
29 | + ThumbnailInterface::OUTPUT_URI, |
|
30 | + ); |
|
31 | + |
|
32 | + /** |
|
33 | + * Configure the output of the thumbnail service whether it is wrapped or not. |
|
34 | + * Default output is: ThumbnailInterface::OUTPUT_IMAGE |
|
35 | + * |
|
36 | + * @var string |
|
37 | + */ |
|
38 | + protected $outputType = ThumbnailInterface::OUTPUT_IMAGE; |
|
39 | + |
|
40 | + /** |
|
41 | + * @var File |
|
42 | + */ |
|
43 | + protected $file; |
|
44 | + |
|
45 | + /** |
|
46 | + * Define width, height and all sort of attributes to render a thumbnail. |
|
47 | + * @see TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::Image |
|
48 | + * @var array |
|
49 | + */ |
|
50 | + protected $configuration = []; |
|
51 | + |
|
52 | + /** |
|
53 | + * Define width, height and all sort of attributes to render the anchor file |
|
54 | + * which is wrapping the image |
|
55 | + * |
|
56 | + * @see TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::Image |
|
57 | + * @var array |
|
58 | + */ |
|
59 | + protected $configurationWrap = []; |
|
60 | + |
|
61 | + /** |
|
62 | + * DOM attributes to add to the image preview. |
|
63 | + * |
|
64 | + * @var array |
|
65 | + */ |
|
66 | + protected $attributes = [ |
|
67 | + 'class' => 'thumbnail', |
|
68 | + ]; |
|
69 | + |
|
70 | + /** |
|
71 | + * Define in which window will the thumbnail be opened. |
|
72 | + * Does only apply if the thumbnail is wrapped (with an anchor). |
|
73 | + * |
|
74 | + * @var string |
|
75 | + */ |
|
76 | + protected $target = ThumbnailInterface::TARGET_BLANK; |
|
77 | + |
|
78 | + /** |
|
79 | + * URI of the wrapping anchor pointing to the file. |
|
80 | + * replacing the "?" <a href="?">...</a> |
|
81 | + * The URI is automatically computed if not set. |
|
82 | + * @var string |
|
83 | + */ |
|
84 | + protected $anchorUri; |
|
85 | + |
|
86 | + /** |
|
87 | + * Whether a time stamp is appended to the image. |
|
88 | + * Appending the time stamp can prevent caching |
|
89 | + * |
|
90 | + * @var bool |
|
91 | + */ |
|
92 | + protected $appendTimeStamp = false; |
|
93 | + |
|
94 | + /** |
|
95 | + * Define the processing type for the thumbnail. |
|
96 | + * As instance for image the default is ProcessedFile::CONTEXT_IMAGECROPSCALEMASK. |
|
97 | + * |
|
98 | + * @var string |
|
99 | + */ |
|
100 | + protected $processingType; |
|
101 | + |
|
102 | + /** |
|
103 | + * Constructor |
|
104 | + * |
|
105 | + * @param File $file |
|
106 | + */ |
|
107 | + public function __construct(File $file = null) |
|
108 | + { |
|
109 | + $this->file = $file; |
|
110 | + } |
|
111 | + |
|
112 | + /** |
|
113 | + * Render a thumbnail of a media |
|
114 | + * |
|
115 | + * @throws MissingTcaConfigurationException |
|
116 | + * @return string |
|
117 | + * @throws \InvalidArgumentException |
|
118 | + */ |
|
119 | + public function create() |
|
120 | + { |
|
121 | + |
|
122 | + if (!$this->file) { |
|
123 | + throw new MissingTcaConfigurationException('Missing File object. Forgotten to set a file?', 1355933144); |
|
124 | + } |
|
125 | + |
|
126 | + // Default class name |
|
127 | + $className = 'Fab\Media\Thumbnail\FallBackThumbnailProcessor'; |
|
128 | + if (File::FILETYPE_IMAGE === $this->file->getType()) { |
|
129 | + $className = 'Fab\Media\Thumbnail\ImageThumbnailProcessor'; |
|
130 | + } elseif (File::FILETYPE_AUDIO === $this->file->getType()) { |
|
131 | + $className = 'Fab\Media\Thumbnail\AudioThumbnailProcessor'; |
|
132 | + } elseif (File::FILETYPE_VIDEO === $this->file->getType()) { |
|
133 | + $className = 'Fab\Media\Thumbnail\VideoThumbnailProcessor'; |
|
134 | + } elseif (File::FILETYPE_APPLICATION === $this->file->getType() || File::FILETYPE_TEXT === $this->file->getType()) { |
|
135 | + $className = 'Fab\Media\Thumbnail\ApplicationThumbnailProcessor'; |
|
136 | + } |
|
137 | + |
|
138 | + /** @var $processorInstance \Fab\Media\Thumbnail\ThumbnailProcessorInterface */ |
|
139 | + $processorInstance = GeneralUtility::makeInstance($className); |
|
140 | + |
|
141 | + $thumbnail = ''; |
|
142 | + if ($this->file->exists()) { |
|
143 | + $thumbnail = $processorInstance->setThumbnailService($this)->create(); |
|
144 | + } else { |
|
145 | + $logger = Logger::getInstance($this); |
|
146 | + $logger->warning(sprintf('Resource not found for File uid "%s" at %s', $this->file->getUid(), $this->file->getIdentifier())); |
|
147 | + } |
|
148 | + |
|
149 | + return $thumbnail; |
|
150 | + } |
|
151 | + |
|
152 | + /** |
|
153 | + * @return array |
|
154 | + */ |
|
155 | + public function getConfigurationWrap() |
|
156 | + { |
|
157 | + return $this->configurationWrap; |
|
158 | + } |
|
159 | + |
|
160 | + /** |
|
161 | + * @param array $configurationWrap |
|
162 | + * @return $this |
|
163 | + */ |
|
164 | + public function setConfigurationWrap($configurationWrap) |
|
165 | + { |
|
166 | + $this->configurationWrap = $configurationWrap; |
|
167 | + return $this; |
|
168 | + } |
|
169 | + |
|
170 | + /** |
|
171 | + * @return mixed |
|
172 | + */ |
|
173 | + public function getFile() |
|
174 | + { |
|
175 | + return $this->file; |
|
176 | + } |
|
177 | + |
|
178 | + /** |
|
179 | + * @return array |
|
180 | + */ |
|
181 | + public function getConfiguration() |
|
182 | + { |
|
183 | + return $this->configuration; |
|
184 | + } |
|
185 | + |
|
186 | + /** |
|
187 | + * @param array|ThumbnailConfiguration $configuration |
|
188 | + * @return $this |
|
189 | + */ |
|
190 | + public function setConfiguration($configuration) |
|
191 | + { |
|
192 | + if ($configuration instanceof ThumbnailConfiguration) { |
|
193 | + $configurationObject = $configuration; |
|
194 | + $configuration = []; |
|
195 | + |
|
196 | + if ($configurationObject->getWidth() > 0) { |
|
197 | + $configuration['width'] = $configurationObject->getWidth(); |
|
198 | + } |
|
199 | + |
|
200 | + if ($configurationObject->getHeight() > 0) { |
|
201 | + $configuration['height'] = $configurationObject->getHeight(); |
|
202 | + } |
|
203 | + |
|
204 | + if ($configurationObject->getStyle()) { |
|
205 | + $this->attributes['style'] = $configurationObject->getStyle(); |
|
206 | + } |
|
207 | + |
|
208 | + if ($configurationObject->getClassName()) { |
|
209 | + $this->attributes['class'] = $configurationObject->getClassName(); |
|
210 | + } |
|
211 | + } |
|
212 | + |
|
213 | + $this->configuration = $configuration; |
|
214 | + return $this; |
|
215 | + } |
|
216 | + |
|
217 | + /** |
|
218 | + * @return array |
|
219 | + */ |
|
220 | + public function getAttributes() |
|
221 | + { |
|
222 | + return $this->attributes; |
|
223 | + } |
|
224 | + |
|
225 | + /** |
|
226 | + * @param array $attributes |
|
227 | + * @return $this |
|
228 | + */ |
|
229 | + public function setAttributes($attributes) |
|
230 | + { |
|
231 | + $this->attributes = $attributes; |
|
232 | + return $this; |
|
233 | + } |
|
234 | + |
|
235 | + /** |
|
236 | + * @return string |
|
237 | + */ |
|
238 | + public function getOutputType() |
|
239 | + { |
|
240 | + return $this->outputType; |
|
241 | + } |
|
242 | + |
|
243 | + /** |
|
244 | + * @throws InvalidKeyInArrayException |
|
245 | + * @param string $outputType |
|
246 | + * @return $this |
|
247 | + */ |
|
248 | + public function setOutputType($outputType) |
|
249 | + { |
|
250 | + if (!in_array($outputType, $this->allowedOutputTypes)) { |
|
251 | + throw new InvalidKeyInArrayException( |
|
252 | + sprintf('Output type "%s" is not allowed', $outputType), |
|
253 | + 1373020076 |
|
254 | + ); |
|
255 | + } |
|
256 | + $this->outputType = $outputType; |
|
257 | + return $this; |
|
258 | + } |
|
259 | + |
|
260 | + /** |
|
261 | + * @return string |
|
262 | + */ |
|
263 | + public function getTarget() |
|
264 | + { |
|
265 | + return $this->target; |
|
266 | + } |
|
267 | + |
|
268 | + /** |
|
269 | + * @param string $target |
|
270 | + * @return $this |
|
271 | + */ |
|
272 | + public function setTarget($target) |
|
273 | + { |
|
274 | + $this->target = $target; |
|
275 | + return $this; |
|
276 | + } |
|
277 | + |
|
278 | + /** |
|
279 | + * @return string |
|
280 | + */ |
|
281 | + public function getAnchorUri() |
|
282 | + { |
|
283 | + return $this->anchorUri; |
|
284 | + } |
|
285 | + |
|
286 | + /** |
|
287 | + * @param string $anchorUri |
|
288 | + * @return $this |
|
289 | + */ |
|
290 | + public function setAnchorUri($anchorUri) |
|
291 | + { |
|
292 | + $this->anchorUri = $anchorUri; |
|
293 | + return $this; |
|
294 | + } |
|
295 | + |
|
296 | + /** |
|
297 | + * @return boolean |
|
298 | + */ |
|
299 | + public function getAppendTimeStamp() |
|
300 | + { |
|
301 | + return $this->appendTimeStamp; |
|
302 | + } |
|
303 | + |
|
304 | + /** |
|
305 | + * @param boolean $appendTimeStamp |
|
306 | + * @return $this |
|
307 | + */ |
|
308 | + public function setAppendTimeStamp($appendTimeStamp) |
|
309 | + { |
|
310 | + $this->appendTimeStamp = (bool)$appendTimeStamp; |
|
311 | + return $this; |
|
312 | + } |
|
313 | + |
|
314 | + /** |
|
315 | + * @return string |
|
316 | + */ |
|
317 | + public function getProcessingType() |
|
318 | + { |
|
319 | + $this->processingType; |
|
320 | + } |
|
321 | + |
|
322 | + /** |
|
323 | + * @param string $processingType |
|
324 | + * @return $this |
|
325 | + */ |
|
326 | + public function setProcessingType($processingType) |
|
327 | + { |
|
328 | + $this->processingType = $processingType; |
|
329 | + return $this; |
|
330 | + } |
|
331 | 331 | |
332 | 332 | } |
@@ -17,96 +17,96 @@ |
||
17 | 17 | class VideoThumbnailProcessor extends AbstractThumbnailProcessor |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * Render a thumbnail of a resource of type video. |
|
22 | - * |
|
23 | - * @return string |
|
24 | - */ |
|
25 | - public function create() |
|
26 | - { |
|
27 | - $steps = $this->getRenderingSteps(); |
|
28 | - |
|
29 | - $result = ''; |
|
30 | - while ($step = array_shift($steps)) { |
|
31 | - $result = $this->$step($result); |
|
32 | - } |
|
33 | - |
|
34 | - return $result; |
|
35 | - } |
|
36 | - |
|
37 | - /** |
|
38 | - * Render the URI of the thumbnail. |
|
39 | - * |
|
40 | - * @return string |
|
41 | - */ |
|
42 | - public function renderUri() |
|
43 | - { |
|
44 | - |
|
45 | - $relativePath = sprintf('Icons/MimeType/%s.png', $this->getFile()->getProperty('extension')); |
|
46 | - $fileNameAndPath = GeneralUtility::getFileAbsFileName('EXT:media/Resources/Public/' . $relativePath); |
|
47 | - if (!file_exists($fileNameAndPath)) { |
|
48 | - $relativePath = 'Icons/UnknownMimeType.png'; |
|
49 | - } |
|
50 | - |
|
51 | - $uri = Path::getRelativePath($relativePath); |
|
52 | - return $this->prefixUri($uri); |
|
53 | - } |
|
54 | - |
|
55 | - /** |
|
56 | - * Render the tag image which is the main one for a thumbnail. |
|
57 | - * |
|
58 | - * @param string $result |
|
59 | - * @return string |
|
60 | - */ |
|
61 | - public function renderTagImage($result) |
|
62 | - { |
|
63 | - |
|
64 | - // Variable $result corresponds to an URL in this case. |
|
65 | - // Analyse the URL and compute the adequate separator between arguments. |
|
66 | - $parameterSeparator = strpos($result, '?') === false ? '?' : '&'; |
|
67 | - |
|
68 | - return sprintf( |
|
69 | - '<img src="%s%s" title="%s" alt="%s" %s/>', |
|
70 | - $result, |
|
71 | - $this->thumbnailService->getAppendTimeStamp() ? $parameterSeparator . $this->getFile()->getProperty('tstamp') : '', |
|
72 | - $this->getTitle(), |
|
73 | - $this->getTitle(), |
|
74 | - $this->renderAttributes() |
|
75 | - ); |
|
76 | - } |
|
77 | - |
|
78 | - /** |
|
79 | - * Compute and return the title of the file. |
|
80 | - * |
|
81 | - * @return string |
|
82 | - */ |
|
83 | - protected function getTitle() |
|
84 | - { |
|
85 | - $result = $this->getFile()->getProperty('title'); |
|
86 | - if (!$result) { |
|
87 | - $result = $this->getFile()->getName(); |
|
88 | - } |
|
89 | - return htmlspecialchars($result); |
|
90 | - } |
|
91 | - |
|
92 | - /** |
|
93 | - * Render a wrapping anchor around the thumbnail. |
|
94 | - * |
|
95 | - * @param string $result |
|
96 | - * @return string |
|
97 | - */ |
|
98 | - public function renderTagAnchor($result) |
|
99 | - { |
|
100 | - |
|
101 | - $file = $this->getFile(); |
|
102 | - |
|
103 | - return sprintf( |
|
104 | - '<a href="%s%s" target="%s" data-uid="%s">%s</a>', |
|
105 | - $this->thumbnailService->getAnchorUri() ? $this->thumbnailService->getAnchorUri() : $file->getPublicUrl(true), |
|
106 | - $this->thumbnailService->getAppendTimeStamp() ? '?' . $file->getProperty('tstamp') : '', |
|
107 | - $this->thumbnailService->getTarget(), |
|
108 | - $file->getUid(), |
|
109 | - $result |
|
110 | - ); |
|
111 | - } |
|
20 | + /** |
|
21 | + * Render a thumbnail of a resource of type video. |
|
22 | + * |
|
23 | + * @return string |
|
24 | + */ |
|
25 | + public function create() |
|
26 | + { |
|
27 | + $steps = $this->getRenderingSteps(); |
|
28 | + |
|
29 | + $result = ''; |
|
30 | + while ($step = array_shift($steps)) { |
|
31 | + $result = $this->$step($result); |
|
32 | + } |
|
33 | + |
|
34 | + return $result; |
|
35 | + } |
|
36 | + |
|
37 | + /** |
|
38 | + * Render the URI of the thumbnail. |
|
39 | + * |
|
40 | + * @return string |
|
41 | + */ |
|
42 | + public function renderUri() |
|
43 | + { |
|
44 | + |
|
45 | + $relativePath = sprintf('Icons/MimeType/%s.png', $this->getFile()->getProperty('extension')); |
|
46 | + $fileNameAndPath = GeneralUtility::getFileAbsFileName('EXT:media/Resources/Public/' . $relativePath); |
|
47 | + if (!file_exists($fileNameAndPath)) { |
|
48 | + $relativePath = 'Icons/UnknownMimeType.png'; |
|
49 | + } |
|
50 | + |
|
51 | + $uri = Path::getRelativePath($relativePath); |
|
52 | + return $this->prefixUri($uri); |
|
53 | + } |
|
54 | + |
|
55 | + /** |
|
56 | + * Render the tag image which is the main one for a thumbnail. |
|
57 | + * |
|
58 | + * @param string $result |
|
59 | + * @return string |
|
60 | + */ |
|
61 | + public function renderTagImage($result) |
|
62 | + { |
|
63 | + |
|
64 | + // Variable $result corresponds to an URL in this case. |
|
65 | + // Analyse the URL and compute the adequate separator between arguments. |
|
66 | + $parameterSeparator = strpos($result, '?') === false ? '?' : '&'; |
|
67 | + |
|
68 | + return sprintf( |
|
69 | + '<img src="%s%s" title="%s" alt="%s" %s/>', |
|
70 | + $result, |
|
71 | + $this->thumbnailService->getAppendTimeStamp() ? $parameterSeparator . $this->getFile()->getProperty('tstamp') : '', |
|
72 | + $this->getTitle(), |
|
73 | + $this->getTitle(), |
|
74 | + $this->renderAttributes() |
|
75 | + ); |
|
76 | + } |
|
77 | + |
|
78 | + /** |
|
79 | + * Compute and return the title of the file. |
|
80 | + * |
|
81 | + * @return string |
|
82 | + */ |
|
83 | + protected function getTitle() |
|
84 | + { |
|
85 | + $result = $this->getFile()->getProperty('title'); |
|
86 | + if (!$result) { |
|
87 | + $result = $this->getFile()->getName(); |
|
88 | + } |
|
89 | + return htmlspecialchars($result); |
|
90 | + } |
|
91 | + |
|
92 | + /** |
|
93 | + * Render a wrapping anchor around the thumbnail. |
|
94 | + * |
|
95 | + * @param string $result |
|
96 | + * @return string |
|
97 | + */ |
|
98 | + public function renderTagAnchor($result) |
|
99 | + { |
|
100 | + |
|
101 | + $file = $this->getFile(); |
|
102 | + |
|
103 | + return sprintf( |
|
104 | + '<a href="%s%s" target="%s" data-uid="%s">%s</a>', |
|
105 | + $this->thumbnailService->getAnchorUri() ? $this->thumbnailService->getAnchorUri() : $file->getPublicUrl(true), |
|
106 | + $this->thumbnailService->getAppendTimeStamp() ? '?' . $file->getProperty('tstamp') : '', |
|
107 | + $this->thumbnailService->getTarget(), |
|
108 | + $file->getUid(), |
|
109 | + $result |
|
110 | + ); |
|
111 | + } |
|
112 | 112 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | { |
44 | 44 | |
45 | 45 | $relativePath = sprintf('Icons/MimeType/%s.png', $this->getFile()->getProperty('extension')); |
46 | - $fileNameAndPath = GeneralUtility::getFileAbsFileName('EXT:media/Resources/Public/' . $relativePath); |
|
46 | + $fileNameAndPath = GeneralUtility::getFileAbsFileName('EXT:media/Resources/Public/'.$relativePath); |
|
47 | 47 | if (!file_exists($fileNameAndPath)) { |
48 | 48 | $relativePath = 'Icons/UnknownMimeType.png'; |
49 | 49 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | return sprintf( |
69 | 69 | '<img src="%s%s" title="%s" alt="%s" %s/>', |
70 | 70 | $result, |
71 | - $this->thumbnailService->getAppendTimeStamp() ? $parameterSeparator . $this->getFile()->getProperty('tstamp') : '', |
|
71 | + $this->thumbnailService->getAppendTimeStamp() ? $parameterSeparator.$this->getFile()->getProperty('tstamp') : '', |
|
72 | 72 | $this->getTitle(), |
73 | 73 | $this->getTitle(), |
74 | 74 | $this->renderAttributes() |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | return sprintf( |
104 | 104 | '<a href="%s%s" target="%s" data-uid="%s">%s</a>', |
105 | 105 | $this->thumbnailService->getAnchorUri() ? $this->thumbnailService->getAnchorUri() : $file->getPublicUrl(true), |
106 | - $this->thumbnailService->getAppendTimeStamp() ? '?' . $file->getProperty('tstamp') : '', |
|
106 | + $this->thumbnailService->getAppendTimeStamp() ? '?'.$file->getProperty('tstamp') : '', |
|
107 | 107 | $this->thumbnailService->getTarget(), |
108 | 108 | $file->getUid(), |
109 | 109 | $result |
@@ -15,96 +15,96 @@ |
||
15 | 15 | class ThumbnailConfiguration |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * @var int |
|
20 | - */ |
|
21 | - protected $width = 0; |
|
22 | - |
|
23 | - /** |
|
24 | - * @var int |
|
25 | - */ |
|
26 | - protected $height = 0; |
|
27 | - |
|
28 | - /** |
|
29 | - * @var string |
|
30 | - */ |
|
31 | - protected $style = ''; |
|
32 | - |
|
33 | - /** |
|
34 | - * @var string |
|
35 | - */ |
|
36 | - protected $className = ''; |
|
37 | - |
|
38 | - /** |
|
39 | - * @return int |
|
40 | - */ |
|
41 | - public function getWidth() |
|
42 | - { |
|
43 | - return $this->width; |
|
44 | - } |
|
45 | - |
|
46 | - /** |
|
47 | - * @param int $width |
|
48 | - * @return $this |
|
49 | - */ |
|
50 | - public function setWidth($width) |
|
51 | - { |
|
52 | - $this->width = $width; |
|
53 | - return $this; |
|
54 | - } |
|
55 | - |
|
56 | - /** |
|
57 | - * @return int |
|
58 | - */ |
|
59 | - public function getHeight() |
|
60 | - { |
|
61 | - return $this->height; |
|
62 | - } |
|
63 | - |
|
64 | - /** |
|
65 | - * @param int $height |
|
66 | - * @return $this |
|
67 | - */ |
|
68 | - public function setHeight($height) |
|
69 | - { |
|
70 | - $this->height = $height; |
|
71 | - return $this; |
|
72 | - } |
|
73 | - |
|
74 | - /** |
|
75 | - * @return string |
|
76 | - */ |
|
77 | - public function getStyle() |
|
78 | - { |
|
79 | - return $this->style; |
|
80 | - } |
|
81 | - |
|
82 | - /** |
|
83 | - * @param string $style |
|
84 | - * @return $this |
|
85 | - */ |
|
86 | - public function setStyle($style) |
|
87 | - { |
|
88 | - $this->style = $style; |
|
89 | - return $this; |
|
90 | - } |
|
91 | - |
|
92 | - /** |
|
93 | - * @return string |
|
94 | - */ |
|
95 | - public function getClassName() |
|
96 | - { |
|
97 | - return $this->className; |
|
98 | - } |
|
99 | - |
|
100 | - /** |
|
101 | - * @param string $className |
|
102 | - * @return $this |
|
103 | - */ |
|
104 | - public function setClassName($className) |
|
105 | - { |
|
106 | - $this->className = $className; |
|
107 | - return $this; |
|
108 | - } |
|
18 | + /** |
|
19 | + * @var int |
|
20 | + */ |
|
21 | + protected $width = 0; |
|
22 | + |
|
23 | + /** |
|
24 | + * @var int |
|
25 | + */ |
|
26 | + protected $height = 0; |
|
27 | + |
|
28 | + /** |
|
29 | + * @var string |
|
30 | + */ |
|
31 | + protected $style = ''; |
|
32 | + |
|
33 | + /** |
|
34 | + * @var string |
|
35 | + */ |
|
36 | + protected $className = ''; |
|
37 | + |
|
38 | + /** |
|
39 | + * @return int |
|
40 | + */ |
|
41 | + public function getWidth() |
|
42 | + { |
|
43 | + return $this->width; |
|
44 | + } |
|
45 | + |
|
46 | + /** |
|
47 | + * @param int $width |
|
48 | + * @return $this |
|
49 | + */ |
|
50 | + public function setWidth($width) |
|
51 | + { |
|
52 | + $this->width = $width; |
|
53 | + return $this; |
|
54 | + } |
|
55 | + |
|
56 | + /** |
|
57 | + * @return int |
|
58 | + */ |
|
59 | + public function getHeight() |
|
60 | + { |
|
61 | + return $this->height; |
|
62 | + } |
|
63 | + |
|
64 | + /** |
|
65 | + * @param int $height |
|
66 | + * @return $this |
|
67 | + */ |
|
68 | + public function setHeight($height) |
|
69 | + { |
|
70 | + $this->height = $height; |
|
71 | + return $this; |
|
72 | + } |
|
73 | + |
|
74 | + /** |
|
75 | + * @return string |
|
76 | + */ |
|
77 | + public function getStyle() |
|
78 | + { |
|
79 | + return $this->style; |
|
80 | + } |
|
81 | + |
|
82 | + /** |
|
83 | + * @param string $style |
|
84 | + * @return $this |
|
85 | + */ |
|
86 | + public function setStyle($style) |
|
87 | + { |
|
88 | + $this->style = $style; |
|
89 | + return $this; |
|
90 | + } |
|
91 | + |
|
92 | + /** |
|
93 | + * @return string |
|
94 | + */ |
|
95 | + public function getClassName() |
|
96 | + { |
|
97 | + return $this->className; |
|
98 | + } |
|
99 | + |
|
100 | + /** |
|
101 | + * @param string $className |
|
102 | + * @return $this |
|
103 | + */ |
|
104 | + public function setClassName($className) |
|
105 | + { |
|
106 | + $this->className = $className; |
|
107 | + return $this; |
|
108 | + } |
|
109 | 109 | |
110 | 110 | } |
@@ -17,96 +17,96 @@ |
||
17 | 17 | class AudioThumbnailProcessor extends AbstractThumbnailProcessor |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * Render a thumbnail of a resource of type audio. |
|
22 | - * |
|
23 | - * @return string |
|
24 | - */ |
|
25 | - public function create() |
|
26 | - { |
|
27 | - $steps = $this->getRenderingSteps(); |
|
28 | - |
|
29 | - $result = ''; |
|
30 | - while ($step = array_shift($steps)) { |
|
31 | - $result = $this->$step($result); |
|
32 | - } |
|
33 | - |
|
34 | - return $result; |
|
35 | - } |
|
36 | - |
|
37 | - /** |
|
38 | - * Render the URI of the thumbnail. |
|
39 | - * |
|
40 | - * @return string |
|
41 | - */ |
|
42 | - public function renderUri() |
|
43 | - { |
|
44 | - |
|
45 | - $relativePath = sprintf('Icons/MimeType/%s.png', $this->getFile()->getProperty('extension')); |
|
46 | - $fileNameAndPath = GeneralUtility::getFileAbsFileName('EXT:media/Resources/Public/' . $relativePath); |
|
47 | - if (!file_exists($fileNameAndPath)) { |
|
48 | - $relativePath = 'Icons/UnknownMimeType.png'; |
|
49 | - } |
|
50 | - |
|
51 | - $uri = Path::getRelativePath($relativePath); |
|
52 | - return $this->prefixUri($uri); |
|
53 | - } |
|
54 | - |
|
55 | - /** |
|
56 | - * Render the tag image which is the main one for a thumbnail. |
|
57 | - * |
|
58 | - * @param string $result |
|
59 | - * @return string |
|
60 | - */ |
|
61 | - public function renderTagImage($result) |
|
62 | - { |
|
63 | - |
|
64 | - // Variable $result corresponds to an URL in this case. |
|
65 | - // Analyse the URL and compute the adequate separator between arguments. |
|
66 | - $parameterSeparator = strpos($result, '?') === false ? '?' : '&'; |
|
67 | - |
|
68 | - return sprintf( |
|
69 | - '<img src="%s%s" title="%s" alt="%s" %s/>', |
|
70 | - $result, |
|
71 | - $this->thumbnailService->getAppendTimeStamp() ? $parameterSeparator . $this->getFile()->getProperty('tstamp') : '', |
|
72 | - $this->getTitle(), |
|
73 | - $this->getTitle(), |
|
74 | - $this->renderAttributes() |
|
75 | - ); |
|
76 | - } |
|
77 | - |
|
78 | - /** |
|
79 | - * Compute and return the title of the file. |
|
80 | - * |
|
81 | - * @return string |
|
82 | - */ |
|
83 | - protected function getTitle() |
|
84 | - { |
|
85 | - $result = $this->getFile()->getProperty('title'); |
|
86 | - if (!$result) { |
|
87 | - $result = $this->getFile()->getName(); |
|
88 | - } |
|
89 | - return htmlspecialchars($result); |
|
90 | - } |
|
91 | - |
|
92 | - /** |
|
93 | - * Render a wrapping anchor around the thumbnail. |
|
94 | - * |
|
95 | - * @param string $result |
|
96 | - * @return string |
|
97 | - */ |
|
98 | - public function renderTagAnchor($result) |
|
99 | - { |
|
100 | - |
|
101 | - $file = $this->getFile(); |
|
102 | - |
|
103 | - return sprintf( |
|
104 | - '<a href="%s%s" target="%s" data-uid="%s">%s</a>', |
|
105 | - $this->thumbnailService->getAnchorUri() ? $this->thumbnailService->getAnchorUri() : $file->getPublicUrl(true), |
|
106 | - $this->thumbnailService->getAppendTimeStamp() ? '?' . $file->getProperty('tstamp') : '', |
|
107 | - $this->thumbnailService->getTarget(), |
|
108 | - $file->getUid(), |
|
109 | - $result |
|
110 | - ); |
|
111 | - } |
|
20 | + /** |
|
21 | + * Render a thumbnail of a resource of type audio. |
|
22 | + * |
|
23 | + * @return string |
|
24 | + */ |
|
25 | + public function create() |
|
26 | + { |
|
27 | + $steps = $this->getRenderingSteps(); |
|
28 | + |
|
29 | + $result = ''; |
|
30 | + while ($step = array_shift($steps)) { |
|
31 | + $result = $this->$step($result); |
|
32 | + } |
|
33 | + |
|
34 | + return $result; |
|
35 | + } |
|
36 | + |
|
37 | + /** |
|
38 | + * Render the URI of the thumbnail. |
|
39 | + * |
|
40 | + * @return string |
|
41 | + */ |
|
42 | + public function renderUri() |
|
43 | + { |
|
44 | + |
|
45 | + $relativePath = sprintf('Icons/MimeType/%s.png', $this->getFile()->getProperty('extension')); |
|
46 | + $fileNameAndPath = GeneralUtility::getFileAbsFileName('EXT:media/Resources/Public/' . $relativePath); |
|
47 | + if (!file_exists($fileNameAndPath)) { |
|
48 | + $relativePath = 'Icons/UnknownMimeType.png'; |
|
49 | + } |
|
50 | + |
|
51 | + $uri = Path::getRelativePath($relativePath); |
|
52 | + return $this->prefixUri($uri); |
|
53 | + } |
|
54 | + |
|
55 | + /** |
|
56 | + * Render the tag image which is the main one for a thumbnail. |
|
57 | + * |
|
58 | + * @param string $result |
|
59 | + * @return string |
|
60 | + */ |
|
61 | + public function renderTagImage($result) |
|
62 | + { |
|
63 | + |
|
64 | + // Variable $result corresponds to an URL in this case. |
|
65 | + // Analyse the URL and compute the adequate separator between arguments. |
|
66 | + $parameterSeparator = strpos($result, '?') === false ? '?' : '&'; |
|
67 | + |
|
68 | + return sprintf( |
|
69 | + '<img src="%s%s" title="%s" alt="%s" %s/>', |
|
70 | + $result, |
|
71 | + $this->thumbnailService->getAppendTimeStamp() ? $parameterSeparator . $this->getFile()->getProperty('tstamp') : '', |
|
72 | + $this->getTitle(), |
|
73 | + $this->getTitle(), |
|
74 | + $this->renderAttributes() |
|
75 | + ); |
|
76 | + } |
|
77 | + |
|
78 | + /** |
|
79 | + * Compute and return the title of the file. |
|
80 | + * |
|
81 | + * @return string |
|
82 | + */ |
|
83 | + protected function getTitle() |
|
84 | + { |
|
85 | + $result = $this->getFile()->getProperty('title'); |
|
86 | + if (!$result) { |
|
87 | + $result = $this->getFile()->getName(); |
|
88 | + } |
|
89 | + return htmlspecialchars($result); |
|
90 | + } |
|
91 | + |
|
92 | + /** |
|
93 | + * Render a wrapping anchor around the thumbnail. |
|
94 | + * |
|
95 | + * @param string $result |
|
96 | + * @return string |
|
97 | + */ |
|
98 | + public function renderTagAnchor($result) |
|
99 | + { |
|
100 | + |
|
101 | + $file = $this->getFile(); |
|
102 | + |
|
103 | + return sprintf( |
|
104 | + '<a href="%s%s" target="%s" data-uid="%s">%s</a>', |
|
105 | + $this->thumbnailService->getAnchorUri() ? $this->thumbnailService->getAnchorUri() : $file->getPublicUrl(true), |
|
106 | + $this->thumbnailService->getAppendTimeStamp() ? '?' . $file->getProperty('tstamp') : '', |
|
107 | + $this->thumbnailService->getTarget(), |
|
108 | + $file->getUid(), |
|
109 | + $result |
|
110 | + ); |
|
111 | + } |
|
112 | 112 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | { |
44 | 44 | |
45 | 45 | $relativePath = sprintf('Icons/MimeType/%s.png', $this->getFile()->getProperty('extension')); |
46 | - $fileNameAndPath = GeneralUtility::getFileAbsFileName('EXT:media/Resources/Public/' . $relativePath); |
|
46 | + $fileNameAndPath = GeneralUtility::getFileAbsFileName('EXT:media/Resources/Public/'.$relativePath); |
|
47 | 47 | if (!file_exists($fileNameAndPath)) { |
48 | 48 | $relativePath = 'Icons/UnknownMimeType.png'; |
49 | 49 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | return sprintf( |
69 | 69 | '<img src="%s%s" title="%s" alt="%s" %s/>', |
70 | 70 | $result, |
71 | - $this->thumbnailService->getAppendTimeStamp() ? $parameterSeparator . $this->getFile()->getProperty('tstamp') : '', |
|
71 | + $this->thumbnailService->getAppendTimeStamp() ? $parameterSeparator.$this->getFile()->getProperty('tstamp') : '', |
|
72 | 72 | $this->getTitle(), |
73 | 73 | $this->getTitle(), |
74 | 74 | $this->renderAttributes() |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | return sprintf( |
104 | 104 | '<a href="%s%s" target="%s" data-uid="%s">%s</a>', |
105 | 105 | $this->thumbnailService->getAnchorUri() ? $this->thumbnailService->getAnchorUri() : $file->getPublicUrl(true), |
106 | - $this->thumbnailService->getAppendTimeStamp() ? '?' . $file->getProperty('tstamp') : '', |
|
106 | + $this->thumbnailService->getAppendTimeStamp() ? '?'.$file->getProperty('tstamp') : '', |
|
107 | 107 | $this->thumbnailService->getTarget(), |
108 | 108 | $file->getUid(), |
109 | 109 | $result |
@@ -18,140 +18,140 @@ |
||
18 | 18 | class ApplicationThumbnailProcessor extends AbstractThumbnailProcessor |
19 | 19 | { |
20 | 20 | |
21 | - /** |
|
22 | - * Render a thumbnail of a resource of type application. |
|
23 | - * |
|
24 | - * @return string |
|
25 | - */ |
|
26 | - public function create() |
|
27 | - { |
|
28 | - |
|
29 | - $steps = $this->getRenderingSteps(); |
|
30 | - |
|
31 | - $result = ''; |
|
32 | - while ($step = array_shift($steps)) { |
|
33 | - $result = $this->$step($result); |
|
34 | - } |
|
35 | - |
|
36 | - return $result; |
|
37 | - } |
|
38 | - |
|
39 | - /** |
|
40 | - * Render the URI of the thumbnail. |
|
41 | - * |
|
42 | - * @return string |
|
43 | - */ |
|
44 | - public function renderUri() |
|
45 | - { |
|
46 | - if ($this->isThumbnailPossible($this->getFile()->getExtension())) { |
|
47 | - $this->processedFile = $this->getFile()->process($this->getProcessingType(), $this->getConfiguration()); |
|
48 | - $uri = $this->processedFile->getPublicUrl(true); |
|
49 | - |
|
50 | - // Update time stamp of processed image at this stage. This is needed for the browser to get new version of the thumbnail. |
|
51 | - if ($this->processedFile->getProperty('originalfilesha1') !== $this->getFile()->getProperty('sha1')) { |
|
52 | - $this->processedFile->updateProperties(array('tstamp' => $this->getFile()->getProperty('tstamp'))); |
|
53 | - } |
|
54 | - } else { |
|
55 | - $uri = $this->getIcon($this->getFile()->getExtension()); |
|
56 | - } |
|
57 | - return $this->prefixUri($uri); |
|
58 | - } |
|
59 | - |
|
60 | - /** |
|
61 | - * Render the tag image which is the main one for a thumbnail. |
|
62 | - * |
|
63 | - * @param string $result |
|
64 | - * @return string |
|
65 | - */ |
|
66 | - public function renderTagImage($result) |
|
67 | - { |
|
68 | - |
|
69 | - // Variable $result corresponds to an URL in this case. |
|
70 | - // Analyse the URL and compute the adequate separator between arguments. |
|
71 | - $parameterSeparator = strpos($result, '?') === false ? '?' : '&'; |
|
72 | - |
|
73 | - return sprintf( |
|
74 | - '<img src="%s%s" title="%s" alt="%s" %s/>', |
|
75 | - $result, |
|
76 | - $this->thumbnailService->getAppendTimeStamp() ? $parameterSeparator . $this->getTimeStamp() : '', |
|
77 | - $this->getTitle(), |
|
78 | - $this->getTitle(), |
|
79 | - $this->renderAttributes() |
|
80 | - ); |
|
81 | - } |
|
82 | - |
|
83 | - /** |
|
84 | - * Compute and return the time stamp. |
|
85 | - * |
|
86 | - * @return int |
|
87 | - */ |
|
88 | - protected function getTimeStamp() |
|
89 | - { |
|
90 | - $result = $this->getFile()->getProperty('tstamp'); |
|
91 | - if ($this->processedFile) { |
|
92 | - $result = $this->processedFile->getProperty('tstamp'); |
|
93 | - } |
|
94 | - return $result; |
|
95 | - } |
|
96 | - |
|
97 | - /** |
|
98 | - * Compute and return the title of the file. |
|
99 | - * |
|
100 | - * @return string |
|
101 | - */ |
|
102 | - protected function getTitle() |
|
103 | - { |
|
104 | - $result = $this->getFile()->getProperty('title'); |
|
105 | - if (empty($result)) { |
|
106 | - $result = $this->getFile()->getName(); |
|
107 | - } |
|
108 | - return htmlspecialchars($result); |
|
109 | - } |
|
110 | - |
|
111 | - /** |
|
112 | - * Render a wrapping anchor around the thumbnail. |
|
113 | - * |
|
114 | - * @param string $result |
|
115 | - * @return string |
|
116 | - */ |
|
117 | - public function renderTagAnchor($result) |
|
118 | - { |
|
119 | - $uri = $this->thumbnailService->getAnchorUri(); |
|
120 | - if (!$uri) { |
|
121 | - $uri = $this->getUri(); |
|
122 | - } |
|
123 | - |
|
124 | - return sprintf( |
|
125 | - '<a href="%s" target="_blank" data-uid="%s">%s</a>', |
|
126 | - $uri, |
|
127 | - $this->getFile()->getUid(), |
|
128 | - $result |
|
129 | - ); |
|
130 | - } |
|
131 | - |
|
132 | - /** |
|
133 | - * @return string |
|
134 | - */ |
|
135 | - protected function getUri() |
|
136 | - { |
|
137 | - $urlParameters = array( |
|
138 | - MediaModule::getParameterPrefix() => [ |
|
139 | - 'controller' => 'Asset', |
|
140 | - 'action' => 'download', |
|
141 | - 'file' => $this->getFile()->getUid(), |
|
142 | - ], |
|
143 | - ); |
|
144 | - return BackendUtility::getModuleUrl(MediaModule::getSignature(), $urlParameters); |
|
145 | - } |
|
146 | - |
|
147 | - /** |
|
148 | - * @return string |
|
149 | - */ |
|
150 | - public function getProcessingType() |
|
151 | - { |
|
152 | - if ($this->thumbnailService->getProcessingType() === null) { |
|
153 | - return ProcessedFile::CONTEXT_IMAGECROPSCALEMASK; |
|
154 | - } |
|
155 | - return $this->thumbnailService->getProcessingType(); |
|
156 | - } |
|
21 | + /** |
|
22 | + * Render a thumbnail of a resource of type application. |
|
23 | + * |
|
24 | + * @return string |
|
25 | + */ |
|
26 | + public function create() |
|
27 | + { |
|
28 | + |
|
29 | + $steps = $this->getRenderingSteps(); |
|
30 | + |
|
31 | + $result = ''; |
|
32 | + while ($step = array_shift($steps)) { |
|
33 | + $result = $this->$step($result); |
|
34 | + } |
|
35 | + |
|
36 | + return $result; |
|
37 | + } |
|
38 | + |
|
39 | + /** |
|
40 | + * Render the URI of the thumbnail. |
|
41 | + * |
|
42 | + * @return string |
|
43 | + */ |
|
44 | + public function renderUri() |
|
45 | + { |
|
46 | + if ($this->isThumbnailPossible($this->getFile()->getExtension())) { |
|
47 | + $this->processedFile = $this->getFile()->process($this->getProcessingType(), $this->getConfiguration()); |
|
48 | + $uri = $this->processedFile->getPublicUrl(true); |
|
49 | + |
|
50 | + // Update time stamp of processed image at this stage. This is needed for the browser to get new version of the thumbnail. |
|
51 | + if ($this->processedFile->getProperty('originalfilesha1') !== $this->getFile()->getProperty('sha1')) { |
|
52 | + $this->processedFile->updateProperties(array('tstamp' => $this->getFile()->getProperty('tstamp'))); |
|
53 | + } |
|
54 | + } else { |
|
55 | + $uri = $this->getIcon($this->getFile()->getExtension()); |
|
56 | + } |
|
57 | + return $this->prefixUri($uri); |
|
58 | + } |
|
59 | + |
|
60 | + /** |
|
61 | + * Render the tag image which is the main one for a thumbnail. |
|
62 | + * |
|
63 | + * @param string $result |
|
64 | + * @return string |
|
65 | + */ |
|
66 | + public function renderTagImage($result) |
|
67 | + { |
|
68 | + |
|
69 | + // Variable $result corresponds to an URL in this case. |
|
70 | + // Analyse the URL and compute the adequate separator between arguments. |
|
71 | + $parameterSeparator = strpos($result, '?') === false ? '?' : '&'; |
|
72 | + |
|
73 | + return sprintf( |
|
74 | + '<img src="%s%s" title="%s" alt="%s" %s/>', |
|
75 | + $result, |
|
76 | + $this->thumbnailService->getAppendTimeStamp() ? $parameterSeparator . $this->getTimeStamp() : '', |
|
77 | + $this->getTitle(), |
|
78 | + $this->getTitle(), |
|
79 | + $this->renderAttributes() |
|
80 | + ); |
|
81 | + } |
|
82 | + |
|
83 | + /** |
|
84 | + * Compute and return the time stamp. |
|
85 | + * |
|
86 | + * @return int |
|
87 | + */ |
|
88 | + protected function getTimeStamp() |
|
89 | + { |
|
90 | + $result = $this->getFile()->getProperty('tstamp'); |
|
91 | + if ($this->processedFile) { |
|
92 | + $result = $this->processedFile->getProperty('tstamp'); |
|
93 | + } |
|
94 | + return $result; |
|
95 | + } |
|
96 | + |
|
97 | + /** |
|
98 | + * Compute and return the title of the file. |
|
99 | + * |
|
100 | + * @return string |
|
101 | + */ |
|
102 | + protected function getTitle() |
|
103 | + { |
|
104 | + $result = $this->getFile()->getProperty('title'); |
|
105 | + if (empty($result)) { |
|
106 | + $result = $this->getFile()->getName(); |
|
107 | + } |
|
108 | + return htmlspecialchars($result); |
|
109 | + } |
|
110 | + |
|
111 | + /** |
|
112 | + * Render a wrapping anchor around the thumbnail. |
|
113 | + * |
|
114 | + * @param string $result |
|
115 | + * @return string |
|
116 | + */ |
|
117 | + public function renderTagAnchor($result) |
|
118 | + { |
|
119 | + $uri = $this->thumbnailService->getAnchorUri(); |
|
120 | + if (!$uri) { |
|
121 | + $uri = $this->getUri(); |
|
122 | + } |
|
123 | + |
|
124 | + return sprintf( |
|
125 | + '<a href="%s" target="_blank" data-uid="%s">%s</a>', |
|
126 | + $uri, |
|
127 | + $this->getFile()->getUid(), |
|
128 | + $result |
|
129 | + ); |
|
130 | + } |
|
131 | + |
|
132 | + /** |
|
133 | + * @return string |
|
134 | + */ |
|
135 | + protected function getUri() |
|
136 | + { |
|
137 | + $urlParameters = array( |
|
138 | + MediaModule::getParameterPrefix() => [ |
|
139 | + 'controller' => 'Asset', |
|
140 | + 'action' => 'download', |
|
141 | + 'file' => $this->getFile()->getUid(), |
|
142 | + ], |
|
143 | + ); |
|
144 | + return BackendUtility::getModuleUrl(MediaModule::getSignature(), $urlParameters); |
|
145 | + } |
|
146 | + |
|
147 | + /** |
|
148 | + * @return string |
|
149 | + */ |
|
150 | + public function getProcessingType() |
|
151 | + { |
|
152 | + if ($this->thumbnailService->getProcessingType() === null) { |
|
153 | + return ProcessedFile::CONTEXT_IMAGECROPSCALEMASK; |
|
154 | + } |
|
155 | + return $this->thumbnailService->getProcessingType(); |
|
156 | + } |
|
157 | 157 | } |
@@ -73,7 +73,7 @@ |
||
73 | 73 | return sprintf( |
74 | 74 | '<img src="%s%s" title="%s" alt="%s" %s/>', |
75 | 75 | $result, |
76 | - $this->thumbnailService->getAppendTimeStamp() ? $parameterSeparator . $this->getTimeStamp() : '', |
|
76 | + $this->thumbnailService->getAppendTimeStamp() ? $parameterSeparator.$this->getTimeStamp() : '', |
|
77 | 77 | $this->getTitle(), |
78 | 78 | $this->getTitle(), |
79 | 79 | $this->renderAttributes() |
@@ -16,39 +16,39 @@ |
||
16 | 16 | class Dimension |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * @var int |
|
21 | - */ |
|
22 | - protected $width = 0; |
|
23 | - |
|
24 | - /** |
|
25 | - * @var int |
|
26 | - */ |
|
27 | - protected $height = 0; |
|
28 | - |
|
29 | - /** |
|
30 | - * @param string $dimension |
|
31 | - */ |
|
32 | - public function __construct($dimension) |
|
33 | - { |
|
34 | - $dimensions = GeneralUtility::trimExplode('x', $dimension); |
|
35 | - $this->width = empty($dimensions[0]) ? 0 : $dimensions[0]; |
|
36 | - $this->height = empty($dimensions[1]) ? 0 : $dimensions[1]; |
|
37 | - } |
|
38 | - |
|
39 | - /** |
|
40 | - * @return mixed |
|
41 | - */ |
|
42 | - public function getWidth() |
|
43 | - { |
|
44 | - return $this->width; |
|
45 | - } |
|
46 | - |
|
47 | - /** |
|
48 | - * @return int |
|
49 | - */ |
|
50 | - public function getHeight() |
|
51 | - { |
|
52 | - return $this->height; |
|
53 | - } |
|
19 | + /** |
|
20 | + * @var int |
|
21 | + */ |
|
22 | + protected $width = 0; |
|
23 | + |
|
24 | + /** |
|
25 | + * @var int |
|
26 | + */ |
|
27 | + protected $height = 0; |
|
28 | + |
|
29 | + /** |
|
30 | + * @param string $dimension |
|
31 | + */ |
|
32 | + public function __construct($dimension) |
|
33 | + { |
|
34 | + $dimensions = GeneralUtility::trimExplode('x', $dimension); |
|
35 | + $this->width = empty($dimensions[0]) ? 0 : $dimensions[0]; |
|
36 | + $this->height = empty($dimensions[1]) ? 0 : $dimensions[1]; |
|
37 | + } |
|
38 | + |
|
39 | + /** |
|
40 | + * @return mixed |
|
41 | + */ |
|
42 | + public function getWidth() |
|
43 | + { |
|
44 | + return $this->width; |
|
45 | + } |
|
46 | + |
|
47 | + /** |
|
48 | + * @return int |
|
49 | + */ |
|
50 | + public function getHeight() |
|
51 | + { |
|
52 | + return $this->height; |
|
53 | + } |
|
54 | 54 | } |
@@ -19,43 +19,43 @@ |
||
19 | 19 | class FileConverter extends AbstractTypeConverter |
20 | 20 | { |
21 | 21 | |
22 | - /** |
|
23 | - * @var array<string> |
|
24 | - */ |
|
25 | - protected $sourceTypes = array('int'); |
|
26 | - |
|
27 | - /** |
|
28 | - * @var string |
|
29 | - */ |
|
30 | - protected $targetType = 'TYPO3\CMS\Core\Resource\File'; |
|
31 | - |
|
32 | - /** |
|
33 | - * @var integer |
|
34 | - */ |
|
35 | - protected $priority = 1; |
|
36 | - |
|
37 | - /** |
|
38 | - * Actually convert from $source to $targetType |
|
39 | - * |
|
40 | - * @param string $source |
|
41 | - * @param string $targetType |
|
42 | - * @param array $convertedChildProperties |
|
43 | - * @param PropertyMappingConfigurationInterface $configuration |
|
44 | - * @return File |
|
45 | - * @api |
|
46 | - */ |
|
47 | - public function convertFrom($source, $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null) |
|
48 | - { |
|
49 | - |
|
50 | - /** @var $file File */ |
|
51 | - $file = ResourceFactory::getInstance()->getFileObject((int)$source); |
|
52 | - |
|
53 | - if (!$file) { |
|
54 | - $message = sprintf('File with identifier "%s" could not be found.', $file); |
|
55 | - throw new \Exception($message, 1433529796); |
|
56 | - } |
|
57 | - |
|
58 | - $file->getType(); // force to internally know its mime-type. |
|
59 | - return $file; |
|
60 | - } |
|
22 | + /** |
|
23 | + * @var array<string> |
|
24 | + */ |
|
25 | + protected $sourceTypes = array('int'); |
|
26 | + |
|
27 | + /** |
|
28 | + * @var string |
|
29 | + */ |
|
30 | + protected $targetType = 'TYPO3\CMS\Core\Resource\File'; |
|
31 | + |
|
32 | + /** |
|
33 | + * @var integer |
|
34 | + */ |
|
35 | + protected $priority = 1; |
|
36 | + |
|
37 | + /** |
|
38 | + * Actually convert from $source to $targetType |
|
39 | + * |
|
40 | + * @param string $source |
|
41 | + * @param string $targetType |
|
42 | + * @param array $convertedChildProperties |
|
43 | + * @param PropertyMappingConfigurationInterface $configuration |
|
44 | + * @return File |
|
45 | + * @api |
|
46 | + */ |
|
47 | + public function convertFrom($source, $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null) |
|
48 | + { |
|
49 | + |
|
50 | + /** @var $file File */ |
|
51 | + $file = ResourceFactory::getInstance()->getFileObject((int)$source); |
|
52 | + |
|
53 | + if (!$file) { |
|
54 | + $message = sprintf('File with identifier "%s" could not be found.', $file); |
|
55 | + throw new \Exception($message, 1433529796); |
|
56 | + } |
|
57 | + |
|
58 | + $file->getType(); // force to internally know its mime-type. |
|
59 | + return $file; |
|
60 | + } |
|
61 | 61 | } |
62 | 62 | \ No newline at end of file |