Merge branch 'oembed_thumbnail_branch' into 'nightly'
add a thumbnail to oembed response just something i added to quitim See merge request !85
This commit is contained in:
commit
c01982c917
@ -89,6 +89,28 @@ class OembedAction extends Action
|
|||||||
$oembed['author_url']=$profile->profileurl;
|
$oembed['author_url']=$profile->profileurl;
|
||||||
$oembed['url']=$notice->getUrl();
|
$oembed['url']=$notice->getUrl();
|
||||||
$oembed['html']=$notice->getRendered();
|
$oembed['html']=$notice->getRendered();
|
||||||
|
|
||||||
|
// maybe add thumbnail
|
||||||
|
$attachments = $notice->attachments();
|
||||||
|
if (!empty($attachments)) {
|
||||||
|
foreach ($attachments as $attachment) {
|
||||||
|
if(is_object($attachment)) {
|
||||||
|
try {
|
||||||
|
$thumb = $attachment->getThumbnail();
|
||||||
|
} catch (ServerException $e) {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
$thumb_url = File_thumbnail::url($thumb->filename);
|
||||||
|
$oembed['thumbnail_url'] = $thumb_url;
|
||||||
|
break; // only first one
|
||||||
|
} catch (ClientException $e) {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'attachment':
|
case 'attachment':
|
||||||
@ -234,4 +256,4 @@ class OembedAction extends Action
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user