96 public function init() {
104 $this->imageList =
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'imagefile_ext'];
115 $relativeFilePath = $filePathOrCombinedFileIdentifier;
117 if (substr($relativeFilePath, 0, 3) ==
'../') {
118 $relativeFilePath = substr($relativeFilePath, 3);
120 $relativeFilePath =
'typo3/' . $relativeFilePath;
122 $relativeFilePath = ltrim($relativeFilePath,
'/');
126 $mTime = filemtime(PATH_site . $relativeFilePath);
128 if (strstr($relativeFilePath,
'../') !== FALSE) {
130 $this->
errorGif(
'File path',
'must not contain',
'"../"');
132 if ($relativeFilePath && file_exists(PATH_site . $relativeFilePath)) {
135 if (preg_match(
'/(.*)\\.([^\\.]*$)/', $relativeFilePath, $reg)) {
136 $ext = strtolower($reg[2]);
137 $ext = $ext ==
'jpeg' ?
'jpg' : $ext;
139 $this->
errorGif(
'Not imagefile!', $ext, basename($relativeFilePath));
142 $this->
errorGif(
'Not imagefile!',
'No ext!', basename($relativeFilePath));
145 $this->
errorGif(
'Input file not found.',
'not found in thumbs.php', basename($relativeFilePath));
151 $check = basename($relativeFilePath) .
':' .
$mTime .
':' .
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'encryptionKey'];
156 $combinedIdentifier =
'0:' . $relativeFilePath;
158 $combinedIdentifier = $filePathOrCombinedFileIdentifier;
161 if (empty($fileObject)) {
165 $OK = $fileObject !== NULL && $fileObject->checkActionPermission(
'read') && $fileObject->calculateChecksum() == $md5sum;
168 $this->image = $fileObject;
172 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);
187 if (is_object($this->image)) {
189 if ($this->image->getExtension() ==
'ttf') {
193 $this->
errorGif(
'Not imagefile!',
'No ext!', $this->image->getName());
204 $sizeParts = explode(
'x', $this->size .
'x' . $this->size);
208 $this->size = implode(
'x', $sizeParts);
210 $sizeMax = max($sizeParts);
216 $outext = $this->image->getExtension() !=
'jpg' || $thmMode & 2 ? ($thmMode & 1 ?
'png' :
'gif') :
'jpg';
217 $outfile =
'tmb_' . substr(md5(($this->image->getName() . $this->mtime .
$this->size)), 0, 10) .
'.' . $outext;
218 $this->output = $outpath . $outfile;
219 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'im']) {
221 if (!file_exists($this->output)) {
225 if (!file_exists($this->output)) {
226 $this->
errorGif(
'No thumb',
'generated!', $this->image->getName());
232 if ($fd = @fopen($this->output,
'rb')) {
233 $fileModificationTime = filemtime($this->output);
234 header(
'Content-Type: image/' . ($outext ===
'jpg' ?
'jpeg' : $outext));
235 header(
'Last-Modified: ' . date(
'r', $fileModificationTime));
236 header(
'ETag: ' . md5($this->output) .
'-' . $fileModificationTime);
238 header(
'Expires: ' . date(
'r', ($fileModificationTime + 30 * 24 * 60 * 60)));
242 $this->
errorGif(
'Read problem!',
'', $this->output);
248 $this->
errorGif(
'No valid',
'inputfile!', basename($this->image));
269 if (!
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'gdlib']) {
270 throw new \RuntimeException(
'TYPO3 Fatal Error: No gdlib. ' . $l1 .
' ' . $l2 .
' ' . $l3, 1270853954);
273 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'gdlib_png']) {
274 header(
'Content-type: image/png');
275 $im = imagecreatefrompng(PATH_typo3 .
'gfx/notfound_thumb.png');
277 header(
'Content-type: image/gif');
278 $im = imagecreatefromgif(PATH_typo3 .
'gfx/notfound_thumb.gif');
281 $white = imageColorAllocate($im, 255, 255, 255);
282 $black = imageColorAllocate($im, 0, 0, 0);
287 imagefilledrectangle($im, $x, 9, 56, 16, $white);
288 imageString($im, $font, $x, 9, $l1, $black);
291 imagefilledrectangle($im, $x, 19, 56, 26, $white);
292 imageString($im, $font, $x, 19, $l2, $black);
295 imagefilledrectangle($im, $x, 29, 56, 36, $white);
296 imageString($im, $font, $x, 29, substr($l3, -14), $black);
299 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'gdlib_png']) {
319 if (!
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'gdlib']) {
320 throw new \RuntimeException(
'TYPO3 Fatal Error: No gdlib.', 1270853953);
323 $im = imageCreate(250, 76);
324 $white = imageColorAllocate($im, 255, 255, 255);
325 $col = imageColorAllocate($im, 0, 0, 0);
327 $string =
'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZzÆæØøÅåÄäÖöÜüß';
330 imagestring($im, 1, 0, 2,
'10', $col);
331 imagestring($im, 1, 0, 15,
'12', $col);
332 imagestring($im, 1, 0, 30,
'14', $col);
333 imagestring($im, 1, 0, 47,
'18', $col);
334 imagestring($im, 1, 0, 68,
'24', $col);
342 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'gdlib_png']) {
343 header(
'Content-type: image/png');
346 header(
'Content-type: image/gif');
360 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'UTF8filesystem']) {
361 $currentLocale = setlocale(LC_CTYPE, 0);
362 setlocale(LC_CTYPE,
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'systemLocale']);
364 $escapedInputName = escapeshellarg($inputName);
365 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'UTF8filesystem']) {
366 setlocale(LC_CTYPE, $currentLocale);
368 return $escapedInputName;
static imageMagickCommand($command, $parameters, $path='')
static isAllowedAbsPath($path)
static forceIntegerInRange($theInt, $min, $max=2000000000, $defaultValue=0)
static canBeInterpretedAsInteger($var)
static fixPermissions($path, $recursive=FALSE)
static shortMD5($input, $len=10)
static trimExplode($delim, $string, $removeEmptyValues=FALSE, $limit=0)
static freetypeDpiComp($font_size)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
static inList($list, $item)
static exec($command, &$output=NULL, &$returnValue=0)