@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | return null; |
43 | 43 | } |
44 | 44 | |
45 | - $content = stream_get_contents($content,3000); |
|
45 | + $content = stream_get_contents($content, 3000); |
|
46 | 46 | |
47 | 47 | //don't create previews of empty text files |
48 | 48 | if (trim($content) === '') { |
@@ -75,12 +75,12 @@ discard block |
||
75 | 75 | imagecolorallocate($image, 255, 255, 255); |
76 | 76 | $textColor = imagecolorallocate($image, 0, 0, 0); |
77 | 77 | |
78 | - $fontFile = __DIR__ . '/../../../core/fonts/NotoSans-Regular.ttf'; |
|
79 | - $fontFileBold = __DIR__ . '/../../../core/fonts/NotoSans-Bold.ttf'; |
|
78 | + $fontFile = __DIR__.'/../../../core/fonts/NotoSans-Regular.ttf'; |
|
79 | + $fontFileBold = __DIR__.'/../../../core/fonts/NotoSans-Bold.ttf'; |
|
80 | 80 | |
81 | 81 | $canUseTTF = function_exists('imagettftext'); |
82 | 82 | |
83 | - $textOffset = (int)min($maxX * 0.05, $maxY * 0.05); |
|
83 | + $textOffset = (int) min($maxX * 0.05, $maxY * 0.05); |
|
84 | 84 | $nextLineStart = 0; |
85 | 85 | $y = $textOffset; |
86 | 86 | foreach ($lines as $line) { |
@@ -106,27 +106,27 @@ discard block |
||
106 | 106 | |
107 | 107 | // Add spacing before headlines |
108 | 108 | if ($actualFontSize !== $fontSize && $y !== $textOffset) { |
109 | - $y += (int)($actualFontSize * 2); |
|
109 | + $y += (int) ($actualFontSize * 2); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | $x = $textOffset; |
113 | - $y += (int)($nextLineStart + $actualFontSize); |
|
113 | + $y += (int) ($nextLineStart + $actualFontSize); |
|
114 | 114 | |
115 | 115 | if ($canUseTTF === true) { |
116 | - $wordWrap = (int)((1 / $actualFontSize * 1.3) * $maxX); |
|
116 | + $wordWrap = (int) ((1 / $actualFontSize * 1.3) * $maxX); |
|
117 | 117 | |
118 | 118 | // Get rid of markdown symbols that we still needed for the font size |
119 | 119 | $line = preg_replace('/^#*\s/', '', $line); |
120 | 120 | |
121 | - $wrappedText = wordwrap($line, $wordWrap,"\n"); |
|
121 | + $wrappedText = wordwrap($line, $wordWrap, "\n"); |
|
122 | 122 | $linesWrapped = count(explode("\n", $wrappedText)); |
123 | 123 | imagettftext($image, $actualFontSize, 0, $x, $y, $textColor, $actualFontSize === $fontSize ? $fontFile : $fontFileBold, $wrappedText); |
124 | - $nextLineStart = (int)($linesWrapped * ceil($actualFontSize * 2)); |
|
124 | + $nextLineStart = (int) ($linesWrapped * ceil($actualFontSize * 2)); |
|
125 | 125 | if ($actualFontSize !== $fontSize && $y !== $textOffset) { |
126 | 126 | $nextLineStart -= $actualFontSize; |
127 | 127 | } |
128 | 128 | } else { |
129 | - $y -= (int)$fontSize; |
|
129 | + $y -= (int) $fontSize; |
|
130 | 130 | imagestring($image, 1, $x, $y, $line, $textColor); |
131 | 131 | $nextLineStart = $fontSize; |
132 | 132 | } |