From: Hypolite Petovan Date: Mon, 20 Jul 2020 04:27:36 +0000 (-0400) Subject: Add support for image preview in attachments in ActivityPub\Processor X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=3894976a2d7dd42784488d3ff3ddb7ff53c25bc1;p=friendica.git Add support for image preview in attachments in ActivityPub\Processor - Address https://github.com/friendica/friendica/issues/8676#issuecomment-650554955 --- diff --git a/src/Protocol/ActivityPub/Processor.php b/src/Protocol/ActivityPub/Processor.php index e4cef17045..177813e32d 100644 --- a/src/Protocol/ActivityPub/Processor.php +++ b/src/Protocol/ActivityPub/Processor.php @@ -115,10 +115,22 @@ class Processor continue 2; } + $item['body'] .= "\n"; + + // image is the preview/thumbnail URL + if (!empty($attach['image'])) { + $item['body'] .= '[url=' . $attach['url'] . ']'; + $attach['url'] = $attach['image']; + } + if (empty($attach['name'])) { - $item['body'] .= "\n[img]" . $attach['url'] . '[/img]'; + $item['body'] .= '[img]' . $attach['url'] . '[/img]'; } else { - $item['body'] .= "\n[img=" . $attach['url'] . ']' . $attach['name'] . '[/img]'; + $item['body'] .= '[img=' . $attach['url'] . ']' . $attach['name'] . '[/img]'; + } + + if (!empty($attach['image'])) { + $item['body'] .= '[/url]'; } } elseif ($filetype == 'audio') { if (!empty($activity['source']) && strpos($activity['source'], $attach['url'])) {