]> git.mxchange.org Git - friendica.git/blobdiff - src/Contact/Avatar.php
messages.po and and corrected typo in comment
[friendica.git] / src / Contact / Avatar.php
index d4368df22baac8771656342f495c83e7cddc5add..02a5a45d4ecda738f1e312baf9111d7b97e8c4e9 100644 (file)
@@ -90,6 +90,8 @@ class Avatar
                $filename  = self::getFilename($contact['url']);
                $timestamp = time();
 
+               $fields['blurhash'] = $image->getBlurHash();
+
                $fields['photo'] = self::storeAvatarCache($image, $filename, Proxy::PIXEL_SMALL, $timestamp);
                $fields['thumb'] = self::storeAvatarCache($image, $filename, Proxy::PIXEL_THUMB, $timestamp);
                $fields['micro'] = self::storeAvatarCache($image, $filename, Proxy::PIXEL_MICRO, $timestamp);
@@ -125,7 +127,7 @@ class Avatar
 
        private static function getFilename(string $url): string
        {
-               $guid = Item::guidFromUri($url, parse_url($url, PHP_URL_HOST));
+               $guid = Item::guidFromUri($url);
 
                return substr($guid, 0, 2) . '/' . substr($guid, 3, 2) . '/' . substr($guid, 5, 3) . '/' .
                        substr($guid, 9, 2) .'/' . substr($guid, 11, 2) . '/' . substr($guid, 13, 4). '/' . substr($guid, 18) . '-';
@@ -161,7 +163,7 @@ class Avatar
                        $dirpath .= $part . '/';
 
                        if (!file_exists($dirpath)) {
-                               if (!@mkdir($dirpath, $dir_perm)) {
+                               if (!@mkdir($dirpath, $dir_perm) && !file_exists($dirpath)) {
                                        Logger::warning('Directory could not be created', ['directory' => $dirpath]);
                                }
                        } elseif ((($old_perm = fileperms($dirpath) & 0777) != $dir_perm) && !chmod($dirpath, $dir_perm)) {