diff options
author | George Hazan <george.hazan@gmail.com> | 2024-03-31 16:16:10 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-03-31 16:16:14 +0300 |
commit | 20ffd35d11cef21fd4866f4b621e783a2d395bee (patch) | |
tree | e8b8da8bf6bc2b9d6bd5d2979e0fa516df7244ef | |
parent | e23adc4331ca6600b775b28dec9725f28998a5ee (diff) |
NewStory: if previews are disabled, we just insert a link to picture
-rw-r--r-- | plugins/NewStory/src/templates.cpp | 22 |
1 files 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"<img style=\"width: %d;\" src=\"%s\" title=\"%s\" alt=\"%s\"/><br>",
- 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"<img style=\"width: %d;\" src=\"%s\" title=\"%s\" alt=\"%s\"/><br>",
+ iWidth, wszUrl.c_str(), wszDescr.c_str(), wszDescr.c_str());
+ }
+ else buf.AppendFormat(L"<a class=\"link\" href=\"%s\">%s</a>", 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"<a class=\"link\" href = \"%s\">%s</a>", wszUrl.c_str(), wszUrl.c_str());
+ buf.AppendFormat(L"<a class=\"link\" href=\"%s\">%s</a>", wszUrl.c_str(), wszUrl.c_str());
p = p2 + 5;
}
}
|