Check for FreeType functions required for avatars#7480
Conversation
| * @return bool | ||
| */ | ||
| protected function hasFreeTypeSupport() { | ||
| if (function_exists('imagettfbbox') && function_exists('imagettftext')) { |
There was a problem hiding this comment.
I'd prefer the shorter version
return function_exists('imagettfbbox') && function_exists('imagettftext');
Codecov Report
@@ Coverage Diff @@
## master #7480 +/- ##
============================================
+ Coverage 51.11% 51.11% +<.01%
- Complexity 24901 24903 +2
============================================
Files 1601 1601
Lines 94774 94778 +4
Branches 1367 1368 +1
============================================
+ Hits 48441 48444 +3
- Misses 46333 46334 +1
|
danxuliu
left a comment
There was a problem hiding this comment.
Tested on a system without FreeType support enabled and works as expected 👍
I have noticed, though, that not having FreeType support affects other elements besides just the avatars, for example the user settings UI (if you create a user or modify a user setting the UI will not be updated, although if you refresh the page you can see that it was modified as expected).
Maybe the error message should be something like "This will result in broken avatars and user settings UI" instead ("will" instead of "can" and "user settings UI" included in the message too)?
|
@danxuliu I don't have a preference. Feel free to change the wording :) |
|
@danxuliu slightly improved:
(We call it »profile picture« in the settings, should not use »avatar« anywhere. Also, no technical abbreviation like »UI«.) |
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
|
I have amended the commits with @jancborchardt suggestion, thanks! |
Fixes #7454