Merge pull request #8309 from nextcloud/8308_13
[stable13] Show open graph preview in WhatsApp
This commit is contained in:
commit
4c21fc802f
|
@ -385,7 +385,18 @@ class ShareController extends Controller {
|
|||
// We just have direct previews for image files
|
||||
if ($share->getNode()->getMimePart() === 'image') {
|
||||
$shareTmpl['previewURL'] = $this->urlGenerator->linkToRouteAbsolute('files_sharing.publicpreview.directLink', ['token' => $token]);
|
||||
|
||||
$ogPreview = $shareTmpl['previewURL'];
|
||||
|
||||
//Whatapp is kind of picky about their size requirements
|
||||
if ($this->request->isUserAgent(['/^WhatsApp/'])) {
|
||||
$ogPreview = $this->urlGenerator->linkToRouteAbsolute('files_sharing.PublicPreview.getPreview', [
|
||||
't' => $token,
|
||||
'x' => 256,
|
||||
'y' => 256,
|
||||
'a' => true,
|
||||
]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$shareTmpl['previewImage'] = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'favicon-fb.png'));
|
||||
|
|
Loading…
Reference in New Issue