133 'png' =>
'-colors 64' 249 'aqua' => array(0, 255, 255),
250 'black' => array(0, 0, 0),
251 'blue' => array(0, 0, 255),
252 'fuchsia' => array(255, 0, 255),
253 'gray' => array(128, 128, 128),
254 'green' => array(0, 128, 0),
255 'lime' => array(0, 255, 0),
256 'maroon' => array(128, 0, 0),
257 'navy' => array(0, 0, 128),
258 'olive' => array(128, 128, 0),
259 'purple' => array(128, 0, 128),
260 'red' => array(255, 0, 0),
261 'silver' => array(192, 192, 192),
262 'teal' => array(0, 128, 128),
263 'yellow' => array(255, 255, 0),
264 'white' => array(255, 255, 255)
289 $gfxConf =
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'];
290 if (function_exists(
'imagecreatefromjpeg') && function_exists(
'imagejpeg')) {
291 $this->gdlibExtensions .=
',jpg,jpeg';
293 if (function_exists(
'imagecreatefrompng') && function_exists(
'imagepng')) {
294 $this->gdlibExtensions .=
',png';
296 if (function_exists(
'imagecreatefromgif') && function_exists(
'imagegif')) {
297 $this->gdlibExtensions .=
',gif';
299 if ($gfxConf[
'png_truecolor']) {
300 $this->png_truecolor = TRUE;
303 if ($gfxConf[
'colorspace'] && in_array($gfxConf[
'colorspace'], $this->allowedColorSpaceNames, TRUE)) {
304 $this->colorspace = $gfxConf[
'colorspace'];
307 if (!$gfxConf[
'im']) {
308 $this->NO_IMAGE_MAGICK = 1;
310 if (!$this->NO_IMAGE_MAGICK && (!$gfxConf[
'im_version_5'] || $gfxConf[
'im_version_5'] ===
'im4' || $gfxConf[
'im_version_5'] ===
'im5')) {
311 throw new \RuntimeException(
'Your TYPO3 installation is configured to use an old version of ImageMagick, which is not supported anymore. ' .
'Please upgrade to ImageMagick version 6 or GraphicksMagick and set $TYPO3_CONF_VARS[\'GFX\'][\'im_version_5\'] appropriately.', 1305059666);
315 if ($this->png_truecolor) {
316 $this->cmds[
'png'] =
'';
320 $this->cmds[
'jpg'] = ($this->cmds[
'jpeg'] =
'-colorspace ' . $this->colorspace .
' -sharpen 50 -quality ' . $this->jpegQuality);
321 if ($gfxConf[
'im_noFramePrepended']) {
322 $this->noFramePrepended = 1;
324 if ($gfxConf[
'gdlib_png']) {
325 $this->gifExtension =
'png';
327 if ($gfxConf[
'enable_typo3temp_db_tracking']) {
328 $this->enable_typo3temp_db_tracking = $gfxConf[
'enable_typo3temp_db_tracking'];
330 $this->imageFileExt = $gfxConf[
'imagefile_ext'];
335 $this->NO_IM_EFFECTS = 1;
336 $this->cmds[
'jpg'] = ($this->cmds[
'jpeg'] =
'-colorspace ' . $this->colorspace .
' -quality ' . $this->jpegQuality);
339 if ($gfxConf[
'im_v5effects']) {
340 $this->NO_IM_EFFECTS = 0;
341 $this->V5_EFFECTS = 1;
342 if ($gfxConf[
'im_v5effects'] > 0) {
343 $this->cmds[
'jpg'] = ($this->cmds[
'jpeg'] =
'-colorspace ' . $this->colorspace .
' -quality ' . (int)$gfxConf[
'jpg_quality'] . $this->
v5_sharpen(10));
347 if ($gfxConf[
'im_noScaleUp']) {
348 $this->mayScaleUp = 0;
351 $this->csConvObj =
$GLOBALS[
'TSFE']->csConvObj;
352 } elseif (is_object(
$GLOBALS[
'LANG'])) {
354 $this->csConvObj =
$GLOBALS[
'LANG']->csConvObj;
359 $this->nativeCharset =
'utf-8';
380 if ($conf[
'file'] && $conf[
'mask']) {
381 $imgInf = pathinfo($conf[
'file']);
382 $imgExt = strtolower($imgInf[
'extension']);
388 $maskInf = pathinfo($conf[
'mask']);
389 $maskExt = strtolower($maskInf[
'extension']);
395 if ($BBimage && $BBmask) {
404 $destImg = imagecreatetruecolor($w, $h);
406 if ($this->saveAlphaLayer) {
407 imagesavealpha($destImg, TRUE);
408 $Bcolor = imagecolorallocatealpha($destImg, 0, 0, 0, 127);
409 imagefill($destImg, 0, 0, $Bcolor);
411 $Bcolor = ImageColorAllocate($destImg, 0, 0, 0);
412 ImageFilledRectangle($destImg, 0, 0, $w, $h, $Bcolor);
416 imageDestroy($cpImg);
417 imageDestroy($destImg);
420 $destImg = imagecreatetruecolor($w, $h);
421 if ($this->saveAlphaLayer) {
422 imagesavealpha($destImg, TRUE);
423 $Bcolor = imagecolorallocatealpha($destImg, 0, 0, 0, 127);
424 imagefill($destImg, 0, 0, $Bcolor);
426 $Bcolor = ImageColorAllocate($destImg, 0, 0, 0);
427 ImageFilledRectangle($destImg, 0, 0, $w, $h, $Bcolor);
431 imageDestroy($cpImg);
432 imageDestroy($destImg);
436 $this->
combineExec($theDest, $theImage, $theMask, $theDest, TRUE);
441 if (!$this->saveAlphaLayer) {
442 ImageColorTransparent($backIm, -1);
447 if (!$this->dontUnlinkTempFiles) {
470 $conf[
'file'] = $conf[
'BBOX'][3];
474 imageDestroy($cpImg);
490 $cpW = imagesx($cpImg);
491 $cpH = imagesy($cpImg);
496 for ($xt = 0; $xt < $tile[0]; $xt++) {
497 $Xstart = $cpOff[0] + $cpW * $xt;
507 $w = $cpW - $cpImgCutX;
514 for ($yt = 0; $yt < $tile[1]; $yt++) {
515 $Ystart = $cpOff[1] + $cpH * $yt;
524 $h = $cpH - $cpImgCutY;
530 $this->
imagecopyresized($im, $cpImg, $Xstart, $Ystart, $cpImgCutX, $cpImgCutY, $w, $h, $w, $h);
570 public function imagecopyresized(&$dstImg, $srcImg, $dstX, $dstY, $srcX, $srcY, $dstWidth, $dstHeight, $srcWidth, $srcHeight) {
571 if (!$this->saveAlphaLayer) {
573 $tmpImg = imagecreatetruecolor(imagesx($dstImg), imagesy($dstImg));
575 imagecopyresized($tmpImg, $dstImg, 0, 0, 0, 0, imagesx($dstImg), imagesy($dstImg), imagesx($dstImg), imagesy($dstImg));
577 imagecopyresized($tmpImg, $srcImg, $dstX, $dstY, $srcX, $srcY, $dstWidth, $dstHeight, $srcWidth, $srcHeight);
581 imagecopyresized($dstImg, $srcImg, $dstX, $dstY, $srcX, $srcY, $dstWidth, $dstHeight, $srcWidth, $srcHeight);
606 if ($conf[
'imgMap'] && is_array($conf[
'imgMap.'])) {
609 if (!$conf[
'hideButCreateMap']) {
613 if (!$conf[
'niceText']) {
614 $Fcolor = ImageColorAllocate($im, $cols[0], $cols[1], $cols[2]);
616 $Fcolor = $conf[
'antiAlias'] ? $Fcolor : -$Fcolor;
617 for ($a = 0; $a < $conf[
'iterations']; $a++) {
619 if ($spacing || $wordSpacing) {
620 $this->
SpacedImageTTFText($im, $conf[
'fontSize'], $conf[
'angle'], $txtPos[0], $txtPos[1], $Fcolor, self::prependAbsolutePath($conf[
'fontFile']), $theText, $spacing, $wordSpacing, $conf[
'splitRendering.']);
622 $this->
renderTTFText($im, $conf[
'fontSize'], $conf[
'angle'], $txtPos[0], $txtPos[1], $Fcolor, $conf[
'fontFile'], $theText, $conf[
'splitRendering.'], $conf);
636 $newW = ceil($sF * imagesx($im));
637 $newH = ceil($sF * imagesy($im));
639 $maskImg = imagecreatetruecolor($newW, $newH);
640 $Bcolor = ImageColorAllocate($maskImg, 255, 255, 255);
641 ImageFilledRectangle($maskImg, 0, 0, $newW, $newH, $Bcolor);
642 $Fcolor = ImageColorAllocate($maskImg, 0, 0, 0);
644 if ($spacing || $wordSpacing) {
645 $this->
SpacedImageTTFText($maskImg, $conf[
'fontSize'], $conf[
'angle'], $txtPos[0], $txtPos[1], $Fcolor, self::prependAbsolutePath($conf[
'fontFile']), $theText, $spacing, $wordSpacing, $conf[
'splitRendering.'], $sF);
647 $this->
renderTTFText($maskImg, $conf[
'fontSize'], $conf[
'angle'], $txtPos[0], $txtPos[1], $Fcolor, $conf[
'fontFile'], $theText, $conf[
'splitRendering.'], $conf, $sF);
650 ImageDestroy($maskImg);
652 if ($this->NO_IM_EFFECTS) {
653 $command = trim($this->scalecmd .
' ' . $w .
'x' . $h .
'! -negate');
655 $command = trim($conf[
'niceText.'][
'before'] .
' ' . $this->scalecmd .
' ' . $w .
'x' . $h .
'! ' . $conf[
'niceText.'][
'after'] .
' -negate');
656 if ($conf[
'niceText.'][
'sharpen']) {
657 if ($this->V5_EFFECTS) {
658 $command .= $this->
v5_sharpen($conf[
'niceText.'][
'sharpen']);
666 $colorImg = imagecreatetruecolor($w, $h);
667 $Ccolor = ImageColorAllocate($colorImg, $cols[0], $cols[1], $cols[2]);
668 ImageFilledRectangle($colorImg, 0, 0, $w, $h, $Ccolor);
670 ImageDestroy($colorImg);
674 $this->
combineExec($fileMenu, $fileColor, $fileMask, $fileMenu);
679 if (!$this->saveAlphaLayer) {
680 ImageColorTransparent($backIm, -1);
685 if (!$this->dontUnlinkTempFiles) {
706 $angle = (int)$conf[
'angle'] / 180 * pi();
708 $straightBB = $this->
calcBBox($conf);
715 switch ($conf[
'align']) {
719 $factor = abs(cos($angle));
720 $sign = cos($angle) < 0 ? -1 : 1;
721 $len1 = $sign * $factor * $straightBB[0];
722 $len2 = $sign * $BB[0];
723 $result[0] = $w - ceil(($len2 * $factor + (1 - $factor) * $len1));
724 $factor = abs(sin($angle));
725 $sign = sin($angle) < 0 ? -1 : 1;
726 $len1 = $sign * $factor * $straightBB[0];
727 $len2 = $sign * $BB[1];
728 $result[1] = ceil($len2 * $factor + (1 - $factor) * $len1);
731 switch ($conf[
'align']) {
760 $charInf = $this->
ImageTTFBBoxWrapper($conf[
'fontSize'], $conf[
'angle'], $conf[
'fontFile'], $theText, $conf[
'splitRendering.'], $sF);
761 $theBBoxInfo = $charInf;
762 if ($conf[
'angle']) {
763 $xArr = array($charInf[0], $charInf[2], $charInf[4], $charInf[6]);
764 $yArr = array($charInf[1], $charInf[3], $charInf[5], $charInf[7]);
765 $x = max($xArr) - min($xArr);
766 $y = max($yArr) - min($yArr);
768 $x = $charInf[2] - $charInf[0];
769 $y = $charInf[1] - $charInf[7];
772 $theBBoxInfo[
'lineHeight'] = $y;
774 if ($spacing || $wordSpacing) {
776 if (!$spacing && $wordSpacing) {
777 $bits = explode(
' ', $theText);
778 foreach ($bits as $word) {
780 $wordInf = $this->
ImageTTFBBoxWrapper($conf[
'fontSize'], $conf[
'angle'], $conf[
'fontFile'], $word, $conf[
'splitRendering.'], $sF);
781 $wordW = $wordInf[2] - $wordInf[0];
782 $x += $wordW + $wordSpacing;
787 foreach ($utf8Chars as $char) {
788 $charInf = $this->
ImageTTFBBoxWrapper($conf[
'fontSize'], $conf[
'angle'], $conf[
'fontFile'], $char, $conf[
'splitRendering.'], $sF);
789 $charW = $charInf[2] - $charInf[0];
790 $x += $charW + ($char ==
' ' ? $wordSpacing : $spacing);
793 } elseif (isset($conf[
'breakWidth']) && $conf[
'breakWidth'] && $this->
getRenderedTextWidth($conf[
'text'], $conf) > $conf[
'breakWidth']) {
796 $breakWidth = $conf[
'breakWidth'];
800 foreach ($wordPairs as $index => $wordPair) {
802 if ($index == 0 || $currentWidth + $wordWidth <= $breakWidth) {
803 $currentWidth += $wordWidth;
805 $maxWidth = max($maxWidth, $currentWidth);
808 $currentWidth = $wordWidth;
811 $x = max($maxWidth, $currentWidth) * $sF;
816 if (is_array($theBBoxInfo)) {
817 foreach ($theBBoxInfo as &$value) {
818 $value = ceil($value / $sF);
823 return array($x, $y, $theBBoxInfo);
837 $this->map .=
'<area' .
' shape="poly"' .
' coords="' . implode(
',', $cords) .
'"' .
' href="' . htmlspecialchars($conf[
'url']) .
'"' . ($conf[
'target'] ?
' target="' . htmlspecialchars($conf[
'target']) .
'"' :
'') . $JS . (strlen($conf[
'titleText']) ?
' title="' . htmlspecialchars($conf[
'titleText']) .
'"' :
'') .
' alt="' . htmlspecialchars($conf[
'altText']) .
'" />';
853 $newCords[0] = $cords[0] + $offset[0] - $pars[0];
854 $newCords[1] = $cords[1] + $offset[1] + $pars[1];
855 $newCords[2] = $cords[2] + $offset[0] + $pars[0];
856 $newCords[3] = $cords[3] + $offset[1] + $pars[1];
857 $newCords[4] = $cords[4] + $offset[0] + $pars[0];
858 $newCords[5] = $cords[5] + $offset[1] - $pars[1];
859 $newCords[6] = $cords[6] + $offset[0] - $pars[0];
860 $newCords[7] = $cords[7] + $offset[1] - $pars[1];
885 public function SpacedImageTTFText(&$im, $fontSize, $angle, $x, $y, $Fcolor, $fontFile, $text, $spacing, $wordSpacing, $splitRenderingConf, $sF = 1) {
888 if (!$spacing && $wordSpacing) {
889 $bits = explode(
' ', $text);
890 foreach ($bits as $word) {
892 $wordInf = $this->
ImageTTFBBoxWrapper($fontSize, $angle, $fontFile, $word, $splitRenderingConf, $sF);
893 $wordW = $wordInf[2] - $wordInf[0];
894 $this->
ImageTTFTextWrapper($im, $fontSize, $angle, $x, $y, $Fcolor, $fontFile, $word, $splitRenderingConf, $sF);
895 $x += $wordW + $wordSpacing;
900 foreach ($utf8Chars as $char) {
901 $charInf = $this->
ImageTTFBBoxWrapper($fontSize, $angle, $fontFile, $char, $splitRenderingConf, $sF);
902 $charW = $charInf[2] - $charInf[0];
903 $this->
ImageTTFTextWrapper($im, $fontSize, $angle, $x, $y, $Fcolor, $fontFile, $char, $splitRenderingConf, $sF);
904 $x += $charW + ($char ==
' ' ? $wordSpacing : $spacing);
920 $maxWidth = (int)$conf[
'maxWidth'];
924 if ($spacing || $wordSpacing) {
925 return $conf[
'fontSize'];
929 $bounds = $this->
ImageTTFBBoxWrapper($conf[
'fontSize'], $conf[
'angle'], $conf[
'fontFile'], $this->
recodeString($conf[
'text']), $conf[
'splitRendering.']);
930 if ($conf[
'angle'] < 0) {
931 $pixelWidth = abs($bounds[4] - $bounds[0]);
932 } elseif ($conf[
'angle'] > 0) {
933 $pixelWidth = abs($bounds[2] - $bounds[6]);
935 $pixelWidth = abs($bounds[4] - $bounds[6]);
938 if ($pixelWidth <= $maxWidth) {
943 }
while ($conf[
'fontSize'] > 1);
946 return $conf[
'fontSize'];
963 $offsetInfo = array();
964 $stringParts = $this->
splitString($string, $splitRendering, $fontSize, $fontFile);
966 foreach ($stringParts as $strCfg) {
967 $fontFile = self::prependAbsolutePath($strCfg[
'fontFile']);
968 if (is_readable($fontFile)) {
979 }
while ($calc[2] < 0 && $try++ < 10);
981 if (!count($offsetInfo)) {
985 $offsetInfo[2] += $calc[2] - $calc[0] + (int)$splitRendering[
'compX'] + (
int)$strCfg[
'xSpaceBefore'] + (int)$strCfg[
'xSpaceAfter'];
986 $offsetInfo[3] += $calc[3] - $calc[1] - (int)$splitRendering[
'compY'] - (
int)$strCfg[
'ySpaceBefore'] - (int)$strCfg[
'ySpaceAfter'];
987 $offsetInfo[4] += $calc[4] - $calc[6] + (int)$splitRendering[
'compX'] + (
int)$strCfg[
'xSpaceBefore'] + (int)$strCfg[
'xSpaceAfter'];
988 $offsetInfo[5] += $calc[5] - $calc[7] - (int)$splitRendering[
'compY'] - (
int)$strCfg[
'ySpaceBefore'] - (int)$strCfg[
'ySpaceAfter'];
991 debug(
'cannot read file: ' . $fontFile,
'TYPO3\\CMS\\Core\\Imaging\\GraphicalFunctions::ImageTTFBBoxWrapper()');
1013 public function ImageTTFTextWrapper($im, $fontSize, $angle, $x, $y, $color, $fontFile, $string, $splitRendering, $sF = 1) {
1015 $stringParts = $this->
splitString($string, $splitRendering, $fontSize, $fontFile);
1016 $x = ceil($sF * $x);
1017 $y = ceil($sF * $y);
1019 foreach ($stringParts as $i => $strCfg) {
1021 $colorIndex = $color;
1023 if ($strCfg[
'color'] && $sF == 1) {
1025 $colorIndex = ImageColorAllocate($im, $cols[0], $cols[1], $cols[2]);
1026 $colorIndex = $color >= 0 ? $colorIndex : -$colorIndex;
1030 $x += (int)$strCfg[
'xSpaceBefore'];
1031 $y -= (int)$strCfg[
'ySpaceBefore'];
1033 $fontFile = self::prependAbsolutePath($strCfg[
'fontFile']);
1034 if (is_readable($fontFile)) {
1038 $wordInf = ImageTTFBBox(
GeneralUtility::freetypeDpiComp($sF * $strCfg[
'fontSize']), $angle, self::prependAbsolutePath($strCfg[
'fontFile']), $strCfg[
'str']);
1039 $x += $wordInf[2] - $wordInf[0] + (int)$splitRendering[
'compX'] + (
int)$strCfg[
'xSpaceAfter'];
1040 $y += $wordInf[5] - $wordInf[7] - (int)$splitRendering[
'compY'] - (
int)$strCfg[
'ySpaceAfter'];
1042 debug(
'cannot read file: ' . $fontFile,
'TYPO3\\CMS\\Core\\Imaging\\GraphicalFunctions::ImageTTFTextWrapper()');
1057 public function splitString($string, $splitRendering, $fontSize, $fontFile) {
1062 'fontSize' => $fontSize,
1063 'fontFile' => $fontFile
1067 if (is_array($splitRendering)) {
1070 foreach ($sKeyArray as $key) {
1071 $cfg = $splitRendering[$key .
'.'];
1073 switch ((
string) $splitRendering[$key]) {
1074 case 'highlightWord':
1075 if (strlen($cfg[
'value'])) {
1076 $newResult = array();
1080 $explodedParts = explode($cfg[
'value'], $part[
'str']);
1081 foreach ($explodedParts as $c => $expValue) {
1082 if (strlen($expValue)) {
1083 $newResult[] = array_merge($part, array(
'str' => $expValue));
1085 if ($c + 1 < count($explodedParts)) {
1086 $newResult[] = array(
1087 'str' => $cfg[
'value'],
1088 'fontSize' => $cfg[
'fontSize'] ? $cfg[
'fontSize'] : $part[
'fontSize'],
1089 'fontFile' => $cfg[
'fontFile'] ? $cfg[
'fontFile'] : $part[
'fontFile'],
1090 'color' => $cfg[
'color'],
1091 'xSpaceBefore' => $cfg[
'xSpaceBefore'],
1092 'xSpaceAfter' => $cfg[
'xSpaceAfter'],
1093 'ySpaceBefore' => $cfg[
'ySpaceBefore'],
1094 'ySpaceAfter' => $cfg[
'ySpaceAfter']
1100 if (count($newResult)) {
1106 if (strlen($cfg[
'value'])) {
1109 foreach ($ranges as $i => $rangeDef) {
1111 if (!isset($ranges[$i][1])) {
1112 $ranges[$i][1] = $ranges[$i][0];
1115 $newResult = array();
1123 foreach ($utf8Chars as $utfChar) {
1125 $uNumber = $this->csConvObj->utf8CharToUnumber($utfChar);
1127 foreach ($ranges as $rangeDef) {
1128 if ($uNumber >= $rangeDef[0] && (!$rangeDef[1] || $uNumber <= $rangeDef[1])) {
1133 if ($currentState == -1) {
1134 $currentState = $inRange;
1140 if (strlen($bankAccum)) {
1141 $newResult[] = array(
1142 'str' => $bankAccum,
1143 'fontSize' => $currentState && $cfg[
'fontSize'] ? $cfg[
'fontSize'] : $part[
'fontSize'],
1144 'fontFile' => $currentState && $cfg[
'fontFile'] ? $cfg[
'fontFile'] : $part[
'fontFile'],
1145 'color' => $currentState ? $cfg[
'color'] :
'',
1146 'xSpaceBefore' => $currentState ? $cfg[
'xSpaceBefore'] :
'',
1147 'xSpaceAfter' => $currentState ? $cfg[
'xSpaceAfter'] :
'',
1148 'ySpaceBefore' => $currentState ? $cfg[
'ySpaceBefore'] :
'',
1149 'ySpaceAfter' => $currentState ? $cfg[
'ySpaceAfter'] :
'' 1153 $currentState = $inRange;
1157 $bankAccum .= $utfChar;
1160 if (strlen($bankAccum)) {
1161 $newResult[] = array(
1162 'str' => $bankAccum,
1163 'fontSize' => $currentState && $cfg[
'fontSize'] ? $cfg[
'fontSize'] : $part[
'fontSize'],
1164 'fontFile' => $currentState && $cfg[
'fontFile'] ? $cfg[
'fontFile'] : $part[
'fontFile'],
1165 'color' => $currentState ? $cfg[
'color'] :
'',
1166 'xSpaceBefore' => $currentState ? $cfg[
'xSpaceBefore'] :
'',
1167 'xSpaceAfter' => $currentState ? $cfg[
'xSpaceAfter'] :
'',
1168 'ySpaceBefore' => $currentState ? $cfg[
'ySpaceBefore'] :
'',
1169 'ySpaceAfter' => $currentState ? $cfg[
'ySpaceAfter'] :
'' 1174 if (count($newResult)) {
1196 $spacing = (int)$conf[
'spacing'];
1197 $wordSpacing = (int)$conf[
'wordSpacing'];
1198 $wordSpacing = $wordSpacing ?: $spacing * 2;
1199 $spacing *= $scaleFactor;
1200 $wordSpacing *= $scaleFactor;
1201 return array($spacing, $wordSpacing);
1213 if (!$conf[
'niceText']) {
1238 protected function renderTTFText(&$im, $fontSize, $angle, $x, $y, $color, $fontFile, $string, $splitRendering, $conf, $sF = 1) {
1239 if (isset($conf[
'breakWidth']) && $conf[
'breakWidth'] && $this->
getRenderedTextWidth($string, $conf) > $conf[
'breakWidth']) {
1242 $breakWidth = $conf[
'breakWidth'];
1246 foreach ($wordPairs as $index => $wordPair) {
1248 if ($index == 0 || $currentWidth + $wordWidth <= $breakWidth) {
1249 $currentWidth += $wordWidth;
1250 $phrase .= $wordPair;
1253 $this->
ImageTTFTextWrapper($im, $fontSize, $angle, $x, $y, $color, $fontFile, $phrase, $splitRendering, $sF);
1257 $currentWidth = $wordWidth;
1258 $phrase = $wordPair;
1262 if ($currentWidth) {
1263 $this->
ImageTTFTextWrapper($im, $fontSize, $angle, $x, $y, $color, $fontFile, $phrase, $splitRendering, $sF);
1266 $this->
ImageTTFTextWrapper($im, $fontSize, $angle, $x, $y, $color, $fontFile, $string, $splitRendering, $sF);
1277 $wordPairs = array();
1278 $wordsArray = preg_split(
'#([- .,!:]+)#', $string, -1, PREG_SPLIT_DELIM_CAPTURE);
1279 $wordsCount = count($wordsArray);
1280 for ($index = 0; $index < $wordsCount; $index += 2) {
1281 $wordPairs[] = $wordsArray[$index] . $wordsArray[($index + 1)];
1295 if ($conf[
'angle'] < 0) {
1296 $pixelWidth = abs($bounds[4] - $bounds[0]);
1297 } elseif ($conf[
'angle'] > 0) {
1298 $pixelWidth = abs($bounds[2] - $bounds[6]);
1300 $pixelWidth = abs($bounds[4] - $bounds[6]);
1313 if (!isset($boundingBox)) {
1314 $boundingBox = $this->
calcBBox($conf);
1315 $boundingBox = $boundingBox[2];
1317 if (isset($conf[
'breakSpace']) && $conf[
'breakSpace']) {
1318 $breakSpace = $boundingBox[
'lineHeight'] * $conf[
'breakSpace'];
1320 $breakSpace = $boundingBox[
'lineHeight'];
1342 $thickness = (int)$conf[
'thickness'];
1344 $txtConf[
'fontColor'] = $conf[
'color'];
1346 for ($b = 1; $b <= $outLineDist; $b++) {
1353 for ($a = 0; $a < $it; $a++) {
1373 if ($distance && $iterations) {
1374 for ($a = 0; $a < $iterations; $a++) {
1375 $yOff = round(sin((2 * pi() / $iterations * ($a + 1))) * 100 * $distance);
1377 $yOff = (int)(ceil(abs(($yOff / 100))) * ($yOff / abs($yOff)));
1379 $xOff = round(cos((2 * pi() / $iterations * ($a + 1))) * 100 * $distance);
1381 $xOff = (int)(ceil(abs(($xOff / 100))) * ($xOff / abs($xOff)));
1383 $res[$a] = array($xOff, $yOff);
1401 $conf[
'color'] = $conf[
'highColor'];
1404 $newOffset[0] *= -1;
1405 $newOffset[1] *= -1;
1406 $conf[
'offset'] = implode(
',', $newOffset);
1407 $conf[
'color'] = $conf[
'lowColor'];
1427 if (!$blurRate || $this->NO_IM_EFFECTS) {
1428 $txtConf[
'fontColor'] = $conf[
'color'];
1440 $blurColImg = imagecreatetruecolor($w, $h);
1442 $Bcolor = ImageColorAllocate($blurColImg, $bcols[0], $bcols[1], $bcols[2]);
1443 ImageFilledRectangle($blurColImg, 0, 0, $w, $h, $Bcolor);
1445 ImageDestroy($blurColImg);
1447 $blurTextImg = imagecreatetruecolor($w + $blurBorder * 2, $h + $blurBorder * 2);
1449 $Bcolor = ImageColorAllocate($blurTextImg, 0, 0, 0);
1450 ImageFilledRectangle($blurTextImg, 0, 0, $w + $blurBorder * 2, $h + $blurBorder * 2, $Bcolor);
1451 $txtConf[
'fontColor'] =
'white';
1452 $blurBordArr = array($blurBorder, $blurBorder);
1457 ImageDestroy($blurTextImg);
1459 if ($this->V5_EFFECTS) {
1460 $command .= $this->
v5_blur($blurRate + 1);
1464 $times = ceil($blurRate / 10);
1466 $newBlurRate = $blurRate * 4;
1469 for ($a = 0; $a < $times; $a++) {
1470 $command .=
' -blur ' . $blurRate;
1477 if ($blurTextImg_tmp) {
1479 $blurTextImg = imagecreatetruecolor($w, $h);
1480 $this->
imagecopyresized($blurTextImg, $blurTextImg_tmp, 0, 0, $blurBorder, $blurBorder, $w, $h, $w, $h);
1482 ImageDestroy($blurTextImg_tmp);
1485 if ($conf[
'intensity']) {
1488 $intensity = ceil(255 - $intensity / 100 * 255);
1491 if ($opacity && $opacity < 100) {
1492 $high = ceil(255 * $opacity / 100);
1499 ImageDestroy($blurTextImg);
1503 $this->
combineExec($fileMenu, $fileColor, $fileMask, $fileMenu);
1508 if (!$this->saveAlphaLayer) {
1509 ImageColorTransparent($backIm, -1);
1515 if (!$this->dontUnlinkTempFiles) {
1540 $conf[
'offset'] = $cords[0] .
',' . $cords[1];
1544 if (isset($conf[
'opacity'])) {
1549 $opacity = abs($opacity - 100);
1550 $opacity = round(127 * $opacity / 100);
1552 $tmpColor = ImageColorAllocateAlpha($im, $cols[0], $cols[1], $cols[2], $opacity);
1553 imagefilledrectangle($im, $cords[0], $cords[1], $cords[0] + $cords[2] - 1, $cords[1] + $cords[3] - 1, $tmpColor);
1580 $conf[
'offset'] = $ellipseConfiguration[0] .
',' . $ellipseConfiguration[1];
1582 $imageCoordinates = $this->
objPosition($conf, $workArea, array($ellipseConfiguration[2], $ellipseConfiguration[3]));
1584 $fillingColor = imagecolorallocate($im, $color[0], $color[1], $color[2]);
1585 imagefilledellipse($im, $imageCoordinates[0], $imageCoordinates[1], $imageCoordinates[2], $imageCoordinates[3], $fillingColor);
1599 $commands = $this->
IMparams($conf[
'value']);
1615 if (!trim($setup)) {
1618 $effects = explode(
'|', $setup);
1620 foreach ($effects as $val) {
1621 $pairs = explode(
'=', $val, 2);
1622 $value = trim(
$pairs[1]);
1623 $effect = strtolower(trim(
$pairs[0]));
1626 $commands .=
' -gamma ' . doubleval($value);
1629 if (!$this->NO_IM_EFFECTS) {
1630 if ($this->V5_EFFECTS) {
1631 $commands .= $this->
v5_blur($value);
1638 if (!$this->NO_IM_EFFECTS) {
1639 if ($this->V5_EFFECTS) {
1663 $commands .=
' -colorspace GRAY';
1669 $commands .=
' -emboss';
1672 $commands .=
' -flip';
1675 $commands .=
' -flop';
1684 $commands .=
' -negate';
1701 $setup = $conf[
'value'];
1702 if (!trim($setup)) {
1705 $effects = explode(
'|', $setup);
1706 foreach ($effects as $val) {
1707 $pairs = explode(
'=', $val, 2);
1708 $value = trim(
$pairs[1]);
1709 $effect = strtolower(trim(
$pairs[0]));
1716 case 'outputlevels':
1721 $this->autoLevels($im);
1736 public function crop(&$im, $conf) {
1740 $conf[
'offset'] = $cords[0] .
',' . $cords[1];
1741 $cords = $this->
objPosition($conf, $this->workArea, array($cords[2], $cords[3]));
1742 $newIm = imagecreatetruecolor($cords[2], $cords[3]);
1743 $cols = $this->
convertColor($conf[
'backColor'] ? $conf[
'backColor'] : $this->setup[
'backColor']);
1744 $Bcolor = ImageColorAllocate($newIm, $cols[0], $cols[1], $cols[2]);
1745 ImageFilledRectangle($newIm, 0, 0, $cords[2], $cords[3], $Bcolor);
1747 $workArea = array(0, 0, $cords[2], $cords[3]);
1748 if ($cords[0] < 0) {
1751 $newConf[
'offset'] = -$cords[0];
1753 if ($cords[1] < 0) {
1756 $newConf[
'offset'] .=
',' . -$cords[1];
1760 $this->w = imagesx($im);
1761 $this->h = imagesy($im);
1776 if ($conf[
'width'] || $conf[
'height'] || $conf[
'params']) {
1780 $theNewFile = $this->
imageMagickConvert($theFile, $this->gifExtension, $conf[
'width'], $conf[
'height'], $conf[
'params']);
1785 $this->w = imagesx($im);
1786 $this->h = imagesy($im);
1790 if (!$this->dontUnlinkTempFiles) {
1792 if ($theNewFile[3] && $theNewFile[3] != $theFile) {
1793 unlink($theNewFile[3]);
1811 $this->workArea = $this->
applyOffset($this->workArea, $this->OFFSET);
1812 if (!$this->workArea[2]) {
1813 $this->workArea[2] = $this->w;
1815 if (!$this->workArea[3]) {
1816 $this->workArea[3] = $this->h;
1833 $totalCols = ImageColorsTotal($im);
1836 for ($c = 0; $c < $totalCols; $c++) {
1837 $cols = ImageColorsForIndex($im, $c);
1838 $grayArr[] = round(($cols[
'red'] + $cols[
'green'] + $cols[
'blue']) / 3);
1840 $min = min($grayArr);
1841 $max = max($grayArr);
1842 $delta = $max - $min;
1844 for ($c = 0; $c < $totalCols; $c++) {
1845 $cols = ImageColorsForIndex($im, $c);
1846 $cols[
'red'] = floor(($cols[
'red'] - $min) / $delta * 255);
1847 $cols[
'green'] = floor(($cols[
'green'] - $min) / $delta * 255);
1848 $cols[
'blue'] = floor(($cols[
'blue'] - $min) / $delta * 255);
1849 ImageColorSet($im, $c, $cols[
'red'], $cols[
'green'], $cols[
'blue']);
1871 $high = 255 - $temp;
1873 $delta = $high - $low;
1874 $totalCols = ImageColorsTotal($im);
1875 for ($c = 0; $c < $totalCols; $c++) {
1876 $cols = ImageColorsForIndex($im, $c);
1877 $cols[
'red'] = $low + floor($cols[
'red'] / 255 * $delta);
1878 $cols[
'green'] = $low + floor($cols[
'green'] / 255 * $delta);
1879 $cols[
'blue'] = $low + floor($cols[
'blue'] / 255 * $delta);
1880 ImageColorSet($im, $c, $cols[
'red'], $cols[
'green'], $cols[
'blue']);
1899 $delta = $high - $low;
1900 $totalCols = ImageColorsTotal($im);
1901 for ($c = 0; $c < $totalCols; $c++) {
1902 $cols = ImageColorsForIndex($im, $c);
1906 ImageColorSet($im, $c, $cols[
'red'], $cols[
'green'], $cols[
'blue']);
1921 $ext = strtolower($fI[
'fileext']);
1924 $params =
' -colors ' . $reduce;
1925 if ($reduce <= 256) {
1926 $params .=
' -type Palette';
1928 if ($ext ==
'png' && $reduce <= 256) {
1954 $absPath = defined(
'PATH_typo3') ? dirname(PATH_thisScript) .
'/' : PATH_site;
1970 $sharpenArr = explode(
',',
',' . $this->im5fx_sharpenSteps);
1971 $sharpenF = trim($sharpenArr[$factor]);
1973 $cmd =
' -sharpen ' . $sharpenF;
1989 $blurArr = explode(
',',
',' . $this->im5fx_blurSteps);
1990 $blurF = trim($blurArr[$factor]);
1992 $cmd =
' -blur ' . $blurF;
2006 return $this->tempPath .
'temp/' . md5(uniqid(
'', TRUE));
2019 $cords[0] = (int)$cords[0] + (
int)$OFFSET[0];
2020 $cords[1] = (int)$cords[1] + (
int)$OFFSET[1];
2034 $cParts = explode(
':', $string, 2);
2036 $string = $cParts[0];
2037 if (strstr($string,
'#')) {
2038 $string = preg_replace(
'/[^A-Fa-f0-9]*/',
'', $string);
2039 $col[] = HexDec(substr($string, 0, 2));
2040 $col[] = HexDec(substr($string, 2, 2));
2041 $col[] = HexDec(substr($string, 4, 2));
2042 } elseif (strstr($string,
',')) {
2043 $string = preg_replace(
'/[^,0-9]*/',
'', $string);
2044 $strArr = explode(
',', $string);
2045 $col[] = (int)$strArr[0];
2046 $col[] = (int)$strArr[1];
2047 $col[] = (int)$strArr[2];
2049 $string = strtolower(trim($string));
2050 if ($this->colMap[$string]) {
2051 $col = $this->colMap[$string];
2053 $col = array(0, 0, 0);
2057 if (trim($cParts[1])) {
2058 $cParts[1] = trim($cParts[1]);
2059 if ($cParts[1][0] ===
'*') {
2060 $val = doubleval(substr($cParts[1], 1));
2065 $val = (int)$cParts[1];
2084 if ($this->nativeCharset && $this->nativeCharset !=
'utf-8') {
2086 $string = $this->csConvObj->utf8_encode($string, $this->nativeCharset);
2101 if ($this->nativeCharset) {
2103 return $this->csConvObj->utf8_to_numberarray($theText, 1, $returnUnicodeNumber ? 0 : 1);
2106 $c = strlen($theText);
2107 for ($a = 0; $a < $c; $a++) {
2108 $output[] = substr($theText, $a, 1);
2132 $align = explode(
',', $conf[
'align']);
2133 $align[0] = strtolower(substr(trim($align[0]), 0, 1));
2134 $align[1] = strtolower(substr(trim($align[1]), 0, 1));
2135 switch ($align[0]) {
2140 $result[0] = round(($w - $result[2]) / 2);
2145 switch ($align[1]) {
2151 $result[1] = round(($h - $result[3]) / 2);
2181 public function imageMagickConvert($imagefile, $newExt =
'', $w =
'', $h =
'', $params =
'', $frame =
'', $options = array(), $mustCreate = FALSE) {
2182 if ($this->NO_IMAGE_MAGICK) {
2187 $newExt = strtolower(trim($newExt));
2192 if ($newExt ==
'web') {
2196 $newExt = $this->
gif_or_jpg($info[2], $info[0], $info[1]);
2198 $params = $this->cmds[$newExt];
2203 if (strstr($w . $h,
'm')) {
2209 $w = $data[
'origW'];
2210 $h = $data[
'origH'];
2216 $noScale = !$w && !$h || $data[0] == $info[0] && $data[1] == $info[1] || !empty($options[
'noScale']);
2217 if ($noScale && !$data[
'crs'] && !$params && !$frame && $newExt == $info[2] && !$mustCreate) {
2220 if (!empty($options[
'noScale'])) {
2221 $info[0] = $data[0];
2222 $info[1] = $data[1];
2224 $info[3] = $imagefile;
2227 $info[0] = $data[0];
2228 $info[1] = $data[1];
2229 $frame = $this->noFramePrepended ?
'' : (int)$frame;
2231 $params = $this->cmds[$newExt];
2235 if (!$data[
'origW']) {
2236 $data[
'origW'] = $data[0];
2238 if (!$data[
'origH']) {
2239 $data[
'origH'] = $data[1];
2241 $offsetX = (int)(($data[0] - $data[
'origW']) * ($data[
'cropH'] + 100) / 200);
2242 $offsetY = (int)(($data[1] - $data[
'origH']) * ($data[
'cropV'] + 100) / 200);
2243 $params .=
' -crop ' . $data[
'origW'] .
'x' . $data[
'origH'] .
'+' . $offsetX .
'+' . $offsetY .
'! ';
2245 $command = $this->scalecmd .
' ' . $info[0] .
'x' . $info[1] .
'! ' . $params .
' ';
2246 $cropscale = $data[
'crs'] ?
'crs-V' . $data[
'cropV'] .
'H' . $data[
'cropH'] :
'';
2247 if ($this->alternativeOutputKey) {
2248 $theOutputName =
GeneralUtility::shortMD5($command . $cropscale . basename($imagefile) . $this->alternativeOutputKey .
'[' . $frame .
']' . $w . $h . serialize($params) . serialize($options));
2250 $theOutputName =
GeneralUtility::shortMD5($command . $cropscale . $imagefile . filemtime($imagefile) .
'[' . $frame .
']' . $w . $h . serialize($params) . serialize($options));
2252 if ($this->imageMagickConvert_forceFileNameBody) {
2254 $this->imageMagickConvert_forceFileNameBody =
'';
2258 $output = $this->absPrefix . $this->tempPath .
'pics/' . $this->filenamePrefix . $theOutputName .
'.' . $newExt;
2260 $GLOBALS[
'TEMP_IMAGES_ON_PAGE'][] = $output;
2264 if (file_exists($output)) {
2271 if ($info[2] == $this->gifExtension && !$this->dontCompress) {
2290 preg_match(
'/([^\\.]*)$/', $imageFile, $reg);
2295 if ($temp = @getImageSize($imageFile)) {
2296 $returnArr = array($temp[0], $temp[1], strtolower($reg[0]), $imageFile);
2319 $fileStatus = stat($identifyResult[3]);
2320 $md5Hash = md5($fileStatus[
'mtime'] . $fileStatus[
'size']);
2323 $fieldArray = array(
2324 'md5hash' => $md5Hash,
2325 'md5filename' => md5($identifyResult[3]),
2327 'filename' => $identifyResult[3],
2328 'imagewidth' => $identifyResult[0],
2329 'imageheight' => $identifyResult[1]
2331 $GLOBALS[
'TYPO3_DB']->exec_INSERTquery(
'cache_imagesizes', $fieldArray);
2332 if (!($err =
$GLOBALS[
'TYPO3_DB']->sql_error())) {
2348 $fileStatus = stat($imageFile);
2349 $md5Hash = md5($fileStatus[
'mtime'] . $fileStatus[
'size']);
2350 $cachedImageDimensions =
$GLOBALS[
'TYPO3_DB']->exec_SELECTgetSingleRow(
'md5hash, md5filename, imagewidth, imageheight',
'cache_imagesizes',
'md5filename=' .
$GLOBALS[
'TYPO3_DB']->fullQuoteStr(md5($imageFile),
'cache_imagesizes'));
2352 if (is_array($cachedImageDimensions)) {
2353 if ($cachedImageDimensions[
'md5hash'] != $md5Hash) {
2355 $GLOBALS[
'TYPO3_DB']->exec_DELETEquery(
'cache_imagesizes',
'md5filename=' .
$GLOBALS[
'TYPO3_DB']->fullQuoteStr($cachedImageDimensions[
'md5filename'],
'cache_imagesizes'));
2357 preg_match(
'/([^\\.]*)$/', $imageFile, $imageExtension);
2359 (
int)$cachedImageDimensions[
'imagewidth'],
2360 (
int)$cachedImageDimensions[
'imageheight'],
2361 strtolower($imageExtension[0]),
2382 if (strstr($w . $h,
'm')) {
2387 if (strstr($w . $h,
'c')) {
2388 $out[
'cropH'] = (int)substr(strstr($w,
'c'), 1);
2389 $out[
'cropV'] = (int)substr(strstr($h,
'c'), 1);
2398 if (!empty($options[
'maxW'])) {
2401 if ($w > $options[
'maxW']) {
2402 $w = $options[
'maxW'];
2407 if ($info[0] > $options[
'maxW']) {
2408 $w = $options[
'maxW'];
2414 if (!empty($options[
'maxH'])) {
2417 if ($h > $options[
'maxH']) {
2418 $h = $options[
'maxH'];
2424 if ($info[1] > $options[
'maxH']) {
2425 $h = $options[
'maxH'];
2434 if (!$this->mayScaleUp) {
2435 if ($w > $info[0]) {
2438 if ($h > $info[1]) {
2445 $info[1] = ceil($info[1] * ($w / $info[0]));
2449 $info[0] = ceil($info[0] * ($h / $info[1]));
2454 $ratio = $info[0] / $info[1];
2455 if ($h * $ratio > $w) {
2456 $h = round($w / $ratio);
2458 $w = round($h * $ratio);
2462 $ratio = $info[0] / $info[1];
2463 if ($h * $ratio < $w) {
2464 $h = round($w / $ratio);
2466 $w = round($h * $ratio);
2476 if (isset($options[
'minW']) && $out[0] < $options[
'minW']) {
2477 if (($max || $crs) && $out[0]) {
2478 $out[1] = round($out[1] * $options[
'minW'] / $out[0]);
2480 $out[0] = $options[
'minW'];
2482 if (isset($options[
'minH']) && $out[1] < $options[
'minH']) {
2483 if (($max || $crs) && $out[1]) {
2484 $out[0] = round($out[0] * $options[
'minH'] / $out[1]);
2486 $out[1] = $options[
'minH'];
2501 if ($this->enable_typo3temp_db_tracking) {
2503 if (file_exists($output)) {
2507 $md5Hash = md5($output);
2508 $res =
$GLOBALS[
'TYPO3_DB']->exec_SELECTquery(
'md5hash',
'cache_typo3temp_log',
'md5hash=' .
$GLOBALS[
'TYPO3_DB']->fullQuoteStr($md5Hash,
'cache_typo3temp_log') .
' AND tstamp>' . (
$GLOBALS[
'EXEC_TIME'] - 30));
2510 if ($row =
$GLOBALS[
'TYPO3_DB']->sql_fetch_assoc($res)) {
2511 $GLOBALS[
'TYPO3_DB']->sql_free_result($res);
2513 $GLOBALS[
'TSFE']->set_no_cache(
'Another process renders this file now: ' . $output);
2517 $GLOBALS[
'TT']->setTSlogMessage(
'typo3temp_log: Assume this file is being rendered now: ' . $output);
2523 $insertFields = array(
2524 'md5hash' => $md5Hash,
2526 'filename' => $output,
2527 'orig_filename' => $orig
2529 $GLOBALS[
'TYPO3_DB']->exec_DELETEquery(
'cache_typo3temp_log',
'md5hash=' .
$GLOBALS[
'TYPO3_DB']->fullQuoteStr($md5Hash,
'cache_typo3temp_log'));
2530 $GLOBALS[
'TYPO3_DB']->exec_INSERTquery(
'cache_typo3temp_log', $insertFields);
2532 $GLOBALS[
'TT']->setTSlogMessage(
'typo3temp_log: The row did not exist, so a new is written and file is being processed: ' . $output);
2538 return file_exists($output);
2556 if (!$this->NO_IMAGE_MAGICK) {
2557 $frame = $this->noFramePrepended ?
'' :
'[0]';
2559 $returnVal = array();
2561 $splitstring = array_pop($returnVal);
2562 $this->IM_commands[] = array(
'identify', $cmd, $splitstring);
2564 preg_match(
'/([^\\.]*)$/', $imagefile, $reg);
2565 $splitinfo = explode(
' ', $splitstring);
2566 foreach ($splitinfo as $key => $val) {
2569 $temp = explode(
'x', $val);
2571 if ((
int)$temp[0] && (
int)$temp[1]) {
2576 if ($dim[0] && $dim[1]) {
2577 return array($dim[0], $dim[1], strtolower($reg[0]), $imagefile);
2595 if (!$this->NO_IMAGE_MAGICK) {
2598 if (!$this->noFramePrepended) {
2599 $frame =
'[' . (int)$frame .
']';
2604 $this->IM_commands[] = array($output, $cmd);
2624 public function combineExec($input, $overlay, $mask, $output, $handleNegation = FALSE) {
2625 if (!$this->NO_IMAGE_MAGICK) {
2626 $params =
'-colorspace GRAY +matte';
2631 $this->IM_commands[] = array($output, $cmd);
2635 if (is_file($theMask)) {
2649 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'UTF8filesystem']) {
2650 $currentLocale = setlocale(LC_CTYPE, 0);
2651 setlocale(LC_CTYPE,
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'systemLocale']);
2653 $escapedInputName = escapeshellarg($inputName);
2654 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'UTF8filesystem']) {
2655 setlocale(LC_CTYPE, $currentLocale);
2657 return $escapedInputName;
2673 if (@is_file($file)) {
2695 if (!@is_dir(($tmpPath . $dirName))) {
2717 $this->w = imagesx($im);
2718 $this->h = imagesy($im);
2720 if (!$this->dontUnlinkTempFiles) {
2736 if ($type ==
'ai' || $w * $h < $this->pixelLimitGif) {
2756 preg_match(
'/([^\\.]*)$/', $file, $reg);
2757 $ext = strtolower($reg[0]);
2764 if ($this->setup[
'reduceColors'] || !$this->png_truecolor) {
2767 @copy($reduced, $file);
2781 if ($this->setup[
'quality']) {
2784 if ($this->
ImageWrite($this->im, $file, $quality)) {
2789 $GLOBALS[
'TEMP_IMAGES_ON_PAGE'][] = $file;
2802 ImageDestroy($this->im);
2813 return '<img src="' . $imgInfo[3] .
'" width="' . $imgInfo[0] .
'" height="' . $imgInfo[1] .
'" border="0" alt="" />';
2827 imageinterlace($destImg, 0);
2828 $ext = strtolower(substr($theImage, strrpos($theImage,
'.') + 1));
2834 if (function_exists(
'imageJpeg')) {
2835 if ($quality == 0) {
2836 $quality = $this->jpegQuality;
2838 $result = imageJpeg($destImg, $theImage, $quality);
2842 if (function_exists(
'imageGif')) {
2843 imagetruecolortopalette($destImg, TRUE, 256);
2844 $result = imageGif($destImg, $theImage);
2848 if (function_exists(
'imagePng')) {
2849 $result = ImagePng($destImg, $theImage);
2868 $imgInf = pathinfo($sourceImg);
2869 $ext = strtolower($imgInf[
'extension']);
2872 if (function_exists(
'imagecreatefromgif')) {
2873 return imageCreateFromGif($sourceImg);
2877 if (function_exists(
'imagecreatefrompng')) {
2878 $imageHandle = imageCreateFromPng($sourceImg);
2879 if ($this->saveAlphaLayer) {
2880 imagesavealpha($imageHandle, TRUE);
2882 return $imageHandle;
2888 if (function_exists(
'imagecreatefromjpeg')) {
2889 return imageCreateFromJpeg($sourceImg);
2894 $i = @getimagesize($sourceImg);
2895 $im = imagecreatetruecolor($i[0], $i[1]);
2896 $Bcolor = ImageColorAllocate($im, 128, 128, 128);
2897 ImageFilledRectangle($im, 0, 0, $i[0], $i[1], $Bcolor);
2909 $r = dechex($col[0]);
2910 if (strlen($r) < 2) {
2913 $g = dechex($col[1]);
2914 if (strlen($g) < 2) {
2917 $b = dechex($col[2]);
2918 if (strlen($b) < 2) {
2921 return '#' . $r . $g . $b;
2935 if (is_array($colArr) && count($colArr) && function_exists(
'imagepng') && function_exists(
'imagecreatefrompng')) {
2936 $firstCol = array_shift($colArr);
2938 if (count($colArr) > 1) {
2939 $origName = ($preName = $this->
randomName() .
'.png');
2941 $this->imageWrite($img, $preName);
2942 $firstCol = $this->
hexColor($firstColArr);
2943 foreach ($colArr as $transparentColor) {
2944 $transparentColor = $this->
convertColor($transparentColor);
2945 $transparentColor = $this->
hexColor($transparentColor);
2946 $cmd =
'-fill "' . $firstCol .
'" -opaque "' . $transparentColor .
'"';
2948 $preName = $postName;
2951 if (@is_file($origName)) {
2960 $retCol = ImageColorClosest($img, $firstColArr[0], $firstColArr[1], $firstColArr[2]);
2962 $retCol = ImageColorExact($img, $firstColArr[0], $firstColArr[1], $firstColArr[2]);
2966 if (!$this->dontUnlinkTempFiles) {
singleChars($theText, $returnUnicodeNumber=FALSE)
calcTextCordsForMap($cords, $offset, $conf)
static imageMagickCommand($command, $parameters, $path='')
copyGifOntoGif(&$im, $cpImg, $conf, $workArea)
makeText(&$im, $conf, $workArea)
makeEmboss(&$im, $conf, $workArea, $txtConf)
txtPosition($conf, $workArea, $BB)
getRenderedTextWidth($text, $conf)
imagecopyresized(&$dstImg, $srcImg, $dstX, $dstY, $srcX, $srcY, $dstWidth, $dstHeight, $srcWidth, $srcHeight)
$dontCheckForExistingTempFile
imageMagickConvert($imagefile, $newExt='', $w='', $h='', $params='', $frame='', $options=array(), $mustCreate=FALSE)
$enable_typo3temp_db_tracking
objPosition($conf, $workArea, $BB)
SpacedImageTTFText(&$im, $fontSize, $angle, $x, $y, $Fcolor, $fontFile, $text, $spacing, $wordSpacing, $splitRenderingConf, $sF=1)
static isFirstPartOfStr($str, $partStr)
circleOffset($distance, $iterations)
static forceIntegerInRange($theInt, $min, $max=2000000000, $defaultValue=0)
if(preg_match($regexp, $sql)) $pairs
Remove pairs of single-quotes.
getBreakSpace($conf, array $boundingBox=NULL)
makeEllipse(&$im, array $conf, array $workArea)
cacheImageDimensions($identifyResult)
getWordPairsForLineBreak($string)
imageMagickExec($input, $output, $params, $frame=0)
static intExplode($delimiter, $string, $removeEmptyValues=FALSE, $limit=0)
prependAbsolutePath($fontFile)
copyImageOntoImage(&$im, $conf, $workArea)
static fixPermissions($path, $recursive=FALSE)
applyOffset($cords, $OFFSET)
static makeInstance($className)
static shortMD5($input, $len=10)
getImageScale($info, $w, $h, $options)
static trimExplode($delim, $string, $removeEmptyValues=FALSE, $limit=0)
ImageTTFTextWrapper($im, $fontSize, $angle, $x, $y, $color, $fontFile, $string, $splitRendering, $sF=1)
getImageDimensions($imageFile)
static split_fileref($fileNameWithPath)
inputLevels(&$im, $low, $high, $swap='')
makeShadow(&$im, $conf, $workArea, $txtConf)
$imageMagickConvert_forceFileNameBody
makeOutline(&$im, $conf, $workArea, $txtConf)
maskImageOntoImage(&$im, $conf, $workArea)
imageCreateFromFile($sourceImg)
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren't numeric.
file_exists_typo3temp_file($output, $orig='')
static gif_compress($theFile, $type)
applyImageMagickToPHPGif(&$im, $command)
createTempSubDir($dirName)
ImageTTFBBoxWrapper($fontSize, $angle, $fontFile, $string, $splitRendering, $sF=1)
calcWordSpacing($conf, $scaleFactor=1)
outputLevels(&$im, $low, $high, $swap='')
IMreduceColors($file, $cols)
imageMagickIdentify($imagefile)
unifyColors(&$img, $colArr, $closest=FALSE)
debug($variable='', $name=' *variable *', $line=' *line *', $file=' *file *', $recursiveDepth=3, $debugLevel=E_DEBUG)
makeBox(&$im, $conf, $workArea)
static freetypeDpiComp($font_size)
renderTTFText(&$im, $fontSize, $angle, $x, $y, $color, $fontFile, $string, $splitRendering, $conf, $sF=1)
ImageWrite($destImg, $theImage, $quality=0)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
gif_or_jpg($type, $w, $h)
static inList($list, $item)
splitString($string, $splitRendering, $fontSize, $fontFile)
getCachedImageDimensions($imageFile)
static exec($command, &$output=NULL, &$returnValue=0)
static resolveBackPath($pathStr)
static sortedKeyList($setupArr, $acceptOnlyProperties=FALSE)
combineExec($input, $overlay, $mask, $output, $handleNegation=FALSE)