Use twemoji

This commit is contained in:
Jill Stingray 2020-06-26 09:30:15 +00:00
parent 8f11700738
commit 7d4fa2886b

View file

@ -8,15 +8,15 @@ trait TRichText
$emojis = \Emoji\detect_emoji($text);
$replaced = []; # OVK-113
foreach($emojis as $emoji) {
$point = strtolower($emoji["hex_str"]);
$point = explode("-", strtolower($emoji["hex_str"]))[0];
if(in_array($point, $replaced))
continue;
else
$replaced[] = $point;
$image = "https://cdn.jsdelivr.net/npm/emojione-assets@4.5.0/png/32/$point.png";
$image = "https://abs.twimg.com/emoji/v2/72x72/$point.png";
$image = "<img src='$image' alt='$emoji[emoji]' ";
$image .= "style='max-height:10pt; padding-left: 2pt; padding-right: 2pt; vertical-align: bottom;' />";
$image .= "style='max-height:12px; padding-left: 2pt; padding-right: 2pt; vertical-align: bottom;' />";
$text = str_replace($emoji["emoji"], $image, $text);
}