From b233f24fe103a745eb6487e236b7cb08269a6cb3 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 19 Oct 2020 11:02:26 +0200 Subject: Change thumbnail creation from nearest neighbor to linear interpolation, set body thumbnail size for 4chan and matrix (if available) --- src/plugins/Fourchan.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/plugins/Fourchan.cpp') diff --git a/src/plugins/Fourchan.cpp b/src/plugins/Fourchan.cpp index 2938319..7f8008c 100644 --- a/src/plugins/Fourchan.cpp +++ b/src/plugins/Fourchan.cpp @@ -252,6 +252,13 @@ namespace QuickMedia { // "s" means small, that's the url 4chan uses for thumbnails. // thumbnails always has .jpg extension even if they are gifs or webm. body_item->thumbnail_url = fourchan_image_url + url + "/" + std::to_string(tim.asInt64()) + "s.jpg"; + + sf::Vector2i thumbnail_size(64, 64); + const Json::Value &tn_w = thread["tn_w"]; + const Json::Value &tn_h = thread["tn_h"]; + if(tn_w.isNumeric() && tn_h.isNumeric()) + thumbnail_size = sf::Vector2i(tn_w.asInt() * 0.5, tn_h.asInt() * 0.5); + body_item->thumbnail_size = std::move(thumbnail_size); } result_items.push_back(std::move(body_item)); @@ -438,6 +445,13 @@ namespace QuickMedia { body_item->thumbnail_url = fourchan_image_url + board_id + "/" + tim_str + "s.jpg"; body_item->attached_content_url = fourchan_image_url + board_id + "/" + tim_str + ext_str; cached_media_urls.push_back(body_item->attached_content_url); + + sf::Vector2i thumbnail_size(64, 64); + const Json::Value &tn_w = post["tn_w"]; + const Json::Value &tn_h = post["tn_h"]; + if(tn_w.isNumeric() && tn_h.isNumeric()) + thumbnail_size = sf::Vector2i(tn_w.asInt(), tn_h.asInt()); + body_item->thumbnail_size = std::move(thumbnail_size); } ++body_item_index; -- cgit v1.2.3