<?php
/**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
$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);
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) . '-';
* Delete locally cached avatar pictures of a contact
*
* @param string $avatar
- * @return void
+ * @return bool
*/
- public static function deleteCache(array $contact)
+ public static function deleteCache(array $contact): bool
{
+ $existed = (self::isCacheFile($contact['photo']) || self::isCacheFile($contact['thumb']) || self::isCacheFile($contact['micro']));
self::deleteCacheFile($contact['photo']);
self::deleteCacheFile($contact['thumb']);
self::deleteCacheFile($contact['micro']);
+
+ return $existed;
}
/**