Inbox Reinvented

This commit is contained in:
Diogo Cordeiro
2018-08-04 04:11:17 +01:00
parent de432cda88
commit 43ebdfa727
29 changed files with 700 additions and 765 deletions

View File

@@ -50,18 +50,22 @@ class Activitypub_attachment extends Managed_DataObject
public static function attachment_to_array($attachment)
{
$res = [
'type' => 'Document',
'mediaType' => $attachment->mimetype,
'url' => $attachment->getUrl(),
'size' => intval($attachment->size), // $attachment->getSize ()
'name' => $attachment->getTitle(),
'@context' => [
'https://www.w3.org/ns/activitystreams',
'https://w3id.org/security/v1'
],
'type' => 'Document',
'mediaType' => $attachment->mimetype,
'url' => $attachment->getUrl(),
'size' => intval($attachment->size), // $attachment->getSize ()
'name' => $attachment->getTitle(),
];
// Image
if (substr($res["mediaType"], 0, 5) == "image") {
$res["meta"]= [
'width' => $attachment->width,
'height' => $attachment->height
'width' => $attachment->width,
'height' => $attachment->height
];
}