mirror of
https://github.com/friendica/friendica
synced 2025-04-27 17:50:17 +00:00
API: Improved avatar handling
This commit is contained in:
parent
a02426c08c
commit
96809b3fdd
5 changed files with 67 additions and 35 deletions
|
@ -1614,7 +1614,7 @@ class Contact
|
|||
*
|
||||
* @param array $contact contact array
|
||||
* @param string $size Size of the avatar picture
|
||||
* @return void
|
||||
* @return string avatar URL
|
||||
*/
|
||||
public static function getDefaultAvatar(array $contact, string $size)
|
||||
{
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
namespace Friendica\Model\Storage;
|
||||
|
||||
use \BadMethodCallException;
|
||||
use Friendica\DI;
|
||||
|
||||
/**
|
||||
* System resource storage class
|
||||
|
@ -41,6 +42,16 @@ class SystemResource implements IStorage
|
|||
*/
|
||||
public function get(string $filename)
|
||||
{
|
||||
$parts = parse_url($filename);
|
||||
if (!empty($parts['scheme']) && !empty($parts['host'])) {
|
||||
$curlResult = DI::httpRequest()->get($filename);
|
||||
if ($curlResult->isSuccess()) {
|
||||
return $curlResult->getBody();
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
$folder = dirname($filename);
|
||||
if (!in_array($folder, self::VALID_FOLDERS)) {
|
||||
return "";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue