aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-12-16 22:01:19 +0100
committerdec05eba <dec05eba@protonmail.com>2022-12-16 22:01:19 +0100
commit35e754008bb449c52cb54ccbf2ed9a21e97009c5 (patch)
treed2f41639602ab35f8110dea9c07a23a01f2c14e9
parent442fc29582b5581111e3ffd286f4f3d282877f3c (diff)
Revert back to non resized url for image thumbnail hash
-rw-r--r--src/AsyncImageLoader.cpp5
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());
}