[Pkg-owncloud-commits] [owncloud] 35/121: implement a txt preview fallback for the case that ttf is not support
David Prévot
taffit at moszumanska.debian.org
Thu Aug 21 16:44:29 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud.
commit 68ba31fd4c649021dcacc86ad8f4d070eb369570
Author: Georg Ehrke <developer at georgehrke.com>
Date: Mon Jul 28 11:56:43 2014 +0200
implement a txt preview fallback for the case that ttf is not support
---
lib/private/preview/txt.php | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/lib/private/preview/txt.php b/lib/private/preview/txt.php
index 063543c..3059757 100644
--- a/lib/private/preview/txt.php
+++ b/lib/private/preview/txt.php
@@ -44,13 +44,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;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list