diff options
author | Morris Jobke <hey@morrisjobke.de> | 2014-08-07 22:55:06 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2014-08-07 22:55:06 +0200 |
commit | b6a2a85bb8b120fac0e9d00b894376c7ae672d8f (patch) | |
tree | 5f7142fb5644ad35328a89a87211d695cd935889 /lib/private/preview | |
parent | 461fdd854fb9eb2c3183f54a25942ad649eb64dc (diff) | |
parent | 4e8e69dc81466aa0ee7798e99c4768d95986b5f1 (diff) | |
download | nextcloud-server-b6a2a85bb8b120fac0e9d00b894376c7ae672d8f.tar.gz nextcloud-server-b6a2a85bb8b120fac0e9d00b894376c7ae672d8f.zip |
Merge pull request #9953 from owncloud/fix_text_preview_for_systems_without_ttf
implement a txt preview fallback for the case that ttf is not support
Diffstat (limited to 'lib/private/preview')
-rw-r--r-- | lib/private/preview/txt.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/private/preview/txt.php b/lib/private/preview/txt.php index b81436baa06..2ac77faf48b 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; |