From 35e754008bb449c52cb54ccbf2ed9a21e97009c5 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 16 Dec 2022 22:01:19 +0100 Subject: Revert back to non resized url for image thumbnail hash --- src/AsyncImageLoader.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/AsyncImageLoader.cpp b/src/AsyncImageLoader.cpp index 8613cf9..4fe7f0d 100644 --- a/src/AsyncImageLoader.cpp +++ b/src/AsyncImageLoader.cpp @@ -314,8 +314,7 @@ namespace QuickMedia { std::shared_ptr AsyncImageLoader::get_thumbnail(const std::string &url, bool local, mgl::vec2i resize_target_size) { // TODO: Instead of generating a new hash everytime to access thumbnail, cache the hash of the thumbnail url. // TODO: Cache this resize_url - std::string resize_url = url + "_" + std::to_string(resize_target_size.x) + "x" + std::to_string(resize_target_size.y); - auto &thumbnail_data = thumbnails[resize_url]; + auto &thumbnail_data = thumbnails[url + "_" + std::to_string(resize_target_size.x) + "x" + std::to_string(resize_target_size.y)]; if(!thumbnail_data) { thumbnail_data = std::make_shared(); thumbnail_data->url = url; @@ -324,7 +323,7 @@ namespace QuickMedia { if(thumbnail_data->thumbnail_path.data.empty()) { SHA256 sha256; - sha256.add(resize_url.data(), resize_url.size()); + sha256.add(url.data(), url.size()); thumbnail_data->thumbnail_path = get_cache_dir().join("thumbnails").join(sha256.getHash()); } -- cgit v1.2.3