diff options
author | Mario <mario@mariovavti.com> | 2024-03-09 20:53:18 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2024-03-09 20:53:18 +0000 |
commit | 46fa26502b285213f3438abb1e3bd1482eb55bf5 (patch) | |
tree | c40ee65fc9da26319e26758c80339124f5247bea /Zotlabs/Module/Emoji.php | |
parent | ba1e705c6154d347000ab6c92ef59f7f6f60e886 (diff) | |
download | volse-hubzilla-46fa26502b285213f3438abb1e3bd1482eb55bf5.tar.gz volse-hubzilla-46fa26502b285213f3438abb1e3bd1482eb55bf5.tar.bz2 volse-hubzilla-46fa26502b285213f3438abb1e3bd1482eb55bf5.zip |
more work on emojis
Diffstat (limited to 'Zotlabs/Module/Emoji.php')
-rw-r--r-- | Zotlabs/Module/Emoji.php | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/Zotlabs/Module/Emoji.php b/Zotlabs/Module/Emoji.php new file mode 100644 index 000000000..595c9fc60 --- /dev/null +++ b/Zotlabs/Module/Emoji.php @@ -0,0 +1,60 @@ +<?php +namespace Zotlabs\Module; + +use Zotlabs\Web\Controller; +use Zotlabs\Daemon\Master; +use Zotlabs\Lib\ActivityStreams; +use App; + + +class Emoji extends Controller { + + function init() { + + $shortname = argv(1); + + if (!$shortname) { + killme(); + } + + $emojis = get_emojis(); + + if (!isset($emojis[$shortname])) { + killme(); + } + + $emoji = $emojis[$shortname]; + +hz_syslog(print_r($emoji, true)); + + + if (!file_exists($emoji['filepath'])) { + killme(); + } + + $image = getimagesize($emoji['filepath']); + + if(ActivityStreams::is_as_request()) { + $last_modified = date(ATOM_TIME, filemtime($emoji['filepath'])); + + $obj = [ + 'id' => z_root() . '/emoji/' . $shortname, + 'type' => 'Emoji', + 'name' => $emoji['shortname'], + 'updated' => $last_modified, + 'icon' => [ + 'type' => 'Image', + 'mediaType' => $image['mime'], + 'url' => z_root() . '/' . $emoji['filepath'] + ] + ]; + + as_return_and_die($obj); + } + + header('Content-Type: ' . $image['mime']); + echo file_get_contents($emoji['filepath']); + killme(); + } + +} |