From 20ffd35d11cef21fd4866f4b621e783a2d395bee Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 31 Mar 2024 16:16:10 +0300 Subject: NewStory: if previews are disabled, we just insert a link to picture --- plugins/NewStory/src/templates.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/plugins/NewStory/src/templates.cpp b/plugins/NewStory/src/templates.cpp index 900b3b3557..4ece9662f5 100644 --- a/plugins/NewStory/src/templates.cpp +++ b/plugins/NewStory/src/templates.cpp @@ -123,14 +123,18 @@ static void AppendString(CMStringW &buf, const wchar_t *p, ItemData *pItem) if (auto *p2 = wcsstr(p1, L"[/img]")) { CMStringW wszDescr(p1, int(p2 - p1)); - int iWidth = 300; - pItem->pOwner->webPage.load_image(wszUrl); - if (Bitmap *pImage = pItem->pOwner->webPage.find_image(wszUrl)) - if (pImage->GetWidth() < 300) - iWidth = pImage->GetWidth(); - - buf.AppendFormat(L"\"%s\"/
", - iWidth, wszUrl.c_str(), wszDescr.c_str(), wszDescr.c_str()); + if (g_plugin.bShowPreview) { + int iWidth = 300; + pItem->pOwner->webPage.load_image(wszUrl); + if (Bitmap *pImage = pItem->pOwner->webPage.find_image(wszUrl)) + if (pImage->GetWidth() < 300) + iWidth = pImage->GetWidth(); + + buf.AppendFormat(L"\"%s\"/
", + iWidth, wszUrl.c_str(), wszDescr.c_str(), wszDescr.c_str()); + } + else buf.AppendFormat(L"%s", wszUrl.c_str(), wszDescr.c_str()); + p = p2 + 5; } } @@ -140,7 +144,7 @@ static void AppendString(CMStringW &buf, const wchar_t *p, ItemData *pItem) if (auto *p2 = wcsstr(p, L"[/url]")) { CMStringW wszUrl(p, int(p2 - p)); - buf.AppendFormat(L"%s", wszUrl.c_str(), wszUrl.c_str()); + buf.AppendFormat(L"%s", wszUrl.c_str(), wszUrl.c_str()); p = p2 + 5; } } -- cgit v1.2.3