Use faster hash algorithum for thumbnail generation

This commit is contained in:
Sheldon Lee 2023-11-19 13:25:21 +08:00
parent c5b4dda950
commit 11c3faddb0

View File

@ -65,7 +65,8 @@ function create_thumbnail(string $category, string $file): string | null {
$path = add_seperator_ab("/", $category, $file);
$original_file = ROOT_DIR.IMG_DIR.$path;
$hash = hash_file("sha1", $original_file);
# use fast hashing algo, see: https://github.com/Cyan4973/xxHash
$hash = hash_file("xxh3", $original_file);
$thumbnail_directory = ROOT_DIR.THUMBNAIL_DIR;
$thumbnail_name = "$hash.jpg";