[TASK] Create new processor registry
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Resource / Processing / ImageProcessingRequest.php
1 <?php
2 namespace TYPO3\CMS\Core\Resource\Processing;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 2014 Frans Saris <franssaris@gmail.com>
8 * All rights reserved
9 *
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 * A copy is found in the text file GPL.txt and important notices to the license
19 * from the author is found in LICENSE.txt distributed with these scripts.
20 *
21 *
22 * This script is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * This copyright notice MUST APPEAR in all copies of the script!
28 ***************************************************************/
29
30 /**
31 * ImageProcessingRequest configuration container
32 */
33 class ImageProcessingRequest extends AbstractProcessingRequest {
34
35 /**
36 * Set width
37 *
38 * @param string $width in pixels add m for max width or c for crop
39 * @return self
40 */
41 public function setWidth($width) {
42 $this->configuration['width'] = $width;
43 return $this;
44 }
45
46 /**
47 * Get width
48 *
49 * @return string
50 */
51 public function getWidth() {
52 $width = NULL;
53 if (isset($this->configuration['width'])) {
54 $width = $this->configuration['width'];
55 }
56 return $width;
57 }
58
59 /**
60 * Set height
61 *
62 * @param string $height in pixels add m for max height or c for crop
63 * @return self
64 */
65 public function setHeight($height) {
66 $this->configuration['height'] = $height;
67 return $this;
68 }
69
70 /**
71 * Get height
72 *
73 * @return string
74 */
75 public function getHeight() {
76 $height = NULL;
77 if (isset($this->configuration['height'])) {
78 $height = $this->configuration['height'];
79 }
80 return $height;
81 }
82
83 /**
84 * Set max width
85 *
86 * @param int $maxWidth
87 * @return self
88 */
89 public function setMaxWidth($maxWidth) {
90 $this->configuration['maxWidth'] = (int)$maxWidth;
91 return $this;
92 }
93
94 /**
95 * Get max height
96 *
97 * @return null|int
98 */
99 public function getMaxWidth() {
100 $maxWidth = NULL;
101 if (isset($this->configuration['maxWidth'])) {
102 $maxWidth = $this->configuration['maxWidth'];
103 }
104 return $maxWidth;
105 }
106
107 /**
108 * Set max height
109 *
110 * @param int $maxHeight
111 * @return self
112 */
113 public function setMaxHeight($maxHeight) {
114 $this->configuration['maxHeight'] = (int)$maxHeight;
115 return $this;
116 }
117
118 /**
119 * Get max height
120 *
121 * @return null|int
122 */
123 public function getMaxHeight() {
124 $maxHeight = NULL;
125 if (isset($this->configuration['maxHeight'])) {
126 $maxHeight = $this->configuration['maxHeight'];
127 }
128 return $maxHeight;
129 }
130
131 /**
132 * Set frame
133 * Frame refers to which frame-number to select in the image
134 *
135 * @param int $frame
136 * @return self
137 */
138 public function setFrame($frame) {
139 $this->configuration['frame'] = (int)$frame;
140 return $this;
141 }
142
143 /**
144 * Get frame
145 * Frame refers to which frame-number to select in the image
146 *
147 * @return int default 0 when not set
148 */
149 public function getFrame() {
150 $frame = 0;
151 if (isset($this->configuration['frame'])) {
152 $frame = $this->configuration['frame'];
153 }
154 return $frame;
155 }
156
157 /**
158 * Set useSample
159 * Instructs GifBuilder to use -sample instead of -geometry
160 * when scaling the image
161 *
162 * @param bool $useSample
163 * @return self
164 */
165 public function setUseSample($useSample) {
166 $this->configuration['useSample'] = $useSample;
167 return $this;
168 }
169
170 /**
171 * Get useSample
172 *
173 * @return bool
174 */
175 public function getUseSample() {
176 return !empty($this->configuration['useSample']);
177 }
178
179 /**
180 * Set noScale
181 *
182 * @param bool $noScale
183 * @return self
184 */
185 public function setNoScale($noScale) {
186 $this->configuration['noScale'] = $noScale;
187 return $this;
188 }
189
190 /**
191 * Get noScale
192 *
193 * @return bool
194 */
195 public function getNoScale() {
196 return !empty($this->configuration['noScale']);
197 }
198
199 /**
200 * Set custom ImageMagick configuration
201 *
202 * @param string $customIMConfig Additional ImageMagick parameters
203 * @return self
204 */
205 public function setCustomIMConfig($customIMConfig) {
206 $this->configuration['customIMConfig'] = $customIMConfig;
207 return $this;
208 }
209
210 /**
211 * Get custom ImageMagick configuration
212 *
213 * @return string
214 */
215 public function getCustomIMConfig() {
216 $customIMConfig = '';
217 if (!empty($this->configuration['customIMConfig'])) {
218 $customIMConfig = $this->configuration['customIMConfig'];
219 }
220 return $customIMConfig;
221 }
222 }