]> git.mxchange.org Git - friendica.git/commitdiff
Use randon pictures for networks that don't support banners
authorMichael <heluecht@pirati.ca>
Sun, 9 Jan 2022 05:24:35 +0000 (05:24 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 9 Jan 2022 05:24:35 +0000 (05:24 +0000)
src/Model/Contact.php

index 9d6d25923a0e76d1a119ceefc018f9d690d56890..f70d01dd2ee5f858ebae70eeb6f3f8e6362b983c 100644 (file)
@@ -2229,6 +2229,7 @@ class Contact
                }
 
                if (empty($ret['header']) && !empty($gsid)) {
+                       // Use default banners for certain platforms
                        $gserver = DBA::selectFirst('gserver', ['platform'], ['id' => $gsid]);
                        switch (strtolower($gserver['platform'] ?? '')) {
                                case 'friendica':
@@ -2253,6 +2254,15 @@ class Contact
                                }
                }
 
+               if (empty($ret['header']) && !in_array($ret['network'], [Protocol::ACTIVITYPUB, Protocol::TWITTER])) {
+                       /**
+                        * Use random pictures for networks that don't provide banners.
+                        * The service provides random pictures from Unsplash.
+                        * @license https://unsplash.com/license
+                        */
+                       $ret['header'] = 'https://picsum.photos/seed/' . hash('ripemd128', $ret['url']) . '/960/300';
+               }
+
                $uriid = ItemURI::insert(['uri' => $ret['url'], 'guid' => $guid]);
 
                if (!$update) {