2 namespace TYPO3\CMS\Backend\View;
88 public function init()
90 GeneralUtility::deprecationLog(
'The class ThumbnailView is deprecated since TYPO3 CMS 7 and will be removed with TYPO3 CMS 8, use the corresponding Resource objects and Processing functionality');
98 $this->imageList =
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'imagefile_ext'];
109 $relativeFilePath = $filePathOrCombinedFileIdentifier;
111 if (substr($relativeFilePath, 0, 3) ==
'../') {
112 $relativeFilePath = substr($relativeFilePath, 3);
114 $relativeFilePath =
'typo3/' . $relativeFilePath;
116 $relativeFilePath = ltrim($relativeFilePath,
'/');
120 $mTime = filemtime(PATH_site . $relativeFilePath);
122 if (strstr($relativeFilePath,
'../') !==
false) {
124 $this->
errorGif(
'File path',
'must not contain',
'"../"');
126 if ($relativeFilePath && file_exists(PATH_site . $relativeFilePath)) {
129 if (preg_match(
'/(.*)\\.([^\\.]*$)/', $relativeFilePath, $reg)) {
130 $ext = strtolower($reg[2]);
131 $ext = $ext ==
'jpeg' ?
'jpg' : $ext;
133 $this->
errorGif(
'Not imagefile!', $ext, basename($relativeFilePath));
136 $this->
errorGif(
'Not imagefile!',
'No ext!', basename($relativeFilePath));
139 $this->
errorGif(
'Input file not found.',
'not found in thumbs.php', basename($relativeFilePath));
145 $check = basename($relativeFilePath) .
':' .
$mTime .
':' .
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'encryptionKey'];
150 $combinedIdentifier =
'0:' . $relativeFilePath;
152 $combinedIdentifier = $filePathOrCombinedFileIdentifier;
155 if (empty($fileObject)) {
159 $OK = $fileObject !== null && $fileObject->checkActionPermission(
'read') && $fileObject->calculateChecksum() == $md5sum;
162 $this->image = $fileObject;
166 throw new \RuntimeException(
'TYPO3 Fatal Error: The requested image does not exist and/or MD5 checksum did not match. If the target file exists and its file name contains special characters, the setting of $TYPO3_CONF_VARS[SYS][systemLocale] might be wrong.', 1270853950);
181 if (is_object($this->image)) {
183 if ($this->image->getExtension() ==
'ttf') {
187 $this->
errorGif(
'Not imagefile!',
'No ext!', $this->image->getName());
198 $sizeParts = explode(
'x', $this->size .
'x' . $this->size);
202 $this->size = implode(
'x', $sizeParts);
204 $sizeMax = max($sizeParts);
210 $outext = $this->image->getExtension() !=
'jpg' || $thmMode &
Permission::PAGE_EDIT ? ($thmMode & 1 ?
'png' :
'gif') :
'jpg';
211 $outfile =
'tmb_' . substr(md5(($this->image->getName() . $this->mtime .
$this->size)), 0, 10) .
'.' . $outext;
212 $this->output = $outpath . $outfile;
213 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'im']) {
215 if (!file_exists($this->output)) {
218 \TYPO3\CMS\Core\Utility\CommandUtility::exec($cmd);
219 if (!file_exists($this->output)) {
220 $this->
errorGif(
'No thumb',
'generated!', $this->image->getName());
226 if ($fd = @fopen($this->output,
'rb')) {
227 $fileModificationTime = filemtime($this->output);
228 header(
'Content-Type: image/' . ($outext ===
'jpg' ?
'jpeg' : $outext));
229 header(
'Last-Modified: ' . date(
'r', $fileModificationTime));
230 header(
'ETag: ' . md5($this->output) .
'-' . $fileModificationTime);
232 header(
'Expires: ' . date(
'r', ($fileModificationTime + 30 * 24 * 60 * 60)));
236 $this->
errorGif(
'Read problem!',
'', $this->output);
242 $this->
errorGif(
'No valid',
'inputfile!', basename($this->image));
263 if (!
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'gdlib']) {
264 throw new \RuntimeException(
'TYPO3 Fatal Error: No gdlib. ' . $l1 .
' ' . $l2 .
' ' . $l3, 1270853954);
267 $basePath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(
'core') .
'Resources/Public/Images/';
268 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'gdlib_png']) {
269 header(
'Content-type: image/png');
270 $im = imagecreatefrompng($basePath .
'NotFound.png');
272 header(
'Content-type: image/gif');
273 $im = imagecreatefromgif($basePath .
'NotFound.gif');
276 $white = imageColorAllocate($im, 255, 255, 255);
277 $black = imageColorAllocate($im, 0, 0, 0);
282 imagefilledrectangle($im, $x, 9, 56, 16, $white);
283 imageString($im, $font, $x, 9, $l1, $black);
286 imagefilledrectangle($im, $x, 19, 56, 26, $white);
287 imageString($im, $font, $x, 19, $l2, $black);
290 imagefilledrectangle($im, $x, 29, 56, 36, $white);
291 imageString($im, $font, $x, 29, substr($l3, -14), $black);
294 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'gdlib_png']) {
314 if (!
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'gdlib']) {
315 throw new \RuntimeException(
'TYPO3 Fatal Error: No gdlib.', 1270853953);
318 $im = imageCreate(250, 76);
319 $white = imageColorAllocate($im, 255, 255, 255);
320 $col = imageColorAllocate($im, 0, 0, 0);
322 $string =
'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZzÆæØøÅåÄäÖöÜüß';
325 imagestring($im, 1, 0, 2,
'10', $col);
326 imagestring($im, 1, 0, 15,
'12', $col);
327 imagestring($im, 1, 0, 30,
'14', $col);
328 imagestring($im, 1, 0, 47,
'18', $col);
329 imagestring($im, 1, 0, 68,
'24', $col);
337 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'gdlib_png']) {
338 header(
'Content-type: image/png');
341 header(
'Content-type: image/gif');