diff --git a/lib/private/preview/txt.php b/lib/private/preview/txt.php index b81436baa068e48f9fed495bc1ae74e9529ed22c..2ac77faf48b17b8d9fe30f4330bb75c093afda6a 100644 --- a/lib/private/preview/txt.php +++ b/lib/private/preview/txt.php @@ -54,13 +54,20 @@ class TXT extends Provider { $fontFile .= '/../../../core'; $fontFile .= '/fonts/OpenSans-Regular.ttf'; + $canUseTTF = function_exists('imagettftext'); + foreach($lines as $index => $line) { $index = $index + 1; $x = (int) 1; $y = (int) ($index * $lineSize); - imagettftext($image, $fontSize, 0, $x, $y, $textColor, $fontFile, $line); + if ($canUseTTF === true) { + imagettftext($image, $fontSize, 0, $x, $y, $textColor, $fontFile, $line); + } else { + $y -= $fontSize; + imagestring($image, 1, $x, $y, $line, $textColor); + } if(($index * $lineSize) >= $maxY) { break;