Improved resource id creation

This commit is contained in:
Michael 2018-02-20 10:02:07 +00:00
parent d90b93cfda
commit a3af6807ac
9 changed files with 23 additions and 37 deletions

View file

@ -100,7 +100,7 @@ class Photo
if (x($photo['resource-id'])) {
$hash = $photo['resource-id'];
} else {
$hash = photo_new_resource();
$hash = self::newResource();
}
$photo_failure = false;
@ -267,4 +267,13 @@ class Photo
$key = "photo_albums:".$uid.":".local_user().":".remote_user();
Cache::set($key, null, CACHE_DAY);
}
/**
* Generate a unique photo ID.
*
* @return string
*/
public static function newResource() {
return get_guid(32, false);
}
}

View file

@ -521,7 +521,7 @@ class User
if ($Image->isValid()) {
$Image->scaleToSquare(175);
$hash = photo_new_resource();
$hash = Photo::newResource();
$r = Photo::store($Image, $uid, 0, $hash, $filename, L10n::t('Profile Photos'), 4);