. * * @category Plugin * @package GNUsocial * @author Diogo Cordeiro * @author Daniel Supernault * @copyright 2015 Free Software Foundaction, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link https://gnu.io/social */ if (!defined('GNUSOCIAL')) { exit(1); } class Activitypub_attachment extends Managed_DataObject { public static function attachmentToObject($attachment) { $res = [ '@context' => [ "https://www.w3.org/ns/activitystreams", [ "@language" => "en" ] ], 'id' => $attachment->getID (), 'mimetype' => $attachment->mimetype, 'url' => $attachment->getUrl (), 'size' => intval($attachment->size), // $attachment->getSize () 'title' => $attachment->getTitle (), 'meta' => null ]; // Image if (substr($res["mimetype"], 0, 5) == "image") { $res["meta"]= [ 'width' => $attachment->width, 'height' => $attachment->height ]; } return $res; } }