diff options
-rw-r--r-- | src/AsyncImageLoader.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
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<ThumbnailData> 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<ThumbnailData>(); 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()); } |