diff --git a/lib/NewsItem.lib.php b/lib/NewsItem.lib.php
index ba39699..50872ed 100644
--- a/lib/NewsItem.lib.php
+++ b/lib/NewsItem.lib.php
@@ -58,4 +58,47 @@ class NewsItem {
return $this->category;
}
+ /**
+ * Generate a HTML card for a grid layout
+ * @return string
+ */
+ function generateGridCard(bool $lazyload = false): string {
+ $category = $this->getCategory()->toString();
+ $url = $this->getURL();
+ $headline = htmlentities($this->getHeadline());
+ $source = $this->getSource();
+ $imghtml = "";
+ if (!empty($this->getImage())) {
+ $imghtml = '';
+ if (strpos($this->getImage(), "preview.redd.it") !== false) {
+ $imgurl = $this->getImage();
+ } else {
+ $imgurl = Thumbnail::getThumbnailCacheURL($this->getImage(), 500);
+ }
+ if ($lazyload) {
+ $imghtml .= '
';
+ $imghtml .= '';
+ } else {
+ $imghtml .= '
';
+ }
+ $imghtml .= '';
+ }
+ $html = <<
+
+
+END;
+ return $html;
+ }
+
}
diff --git a/static/img/news-placeholder.svg b/static/img/news-placeholder.svg
new file mode 100644
index 0000000..2437b2e
--- /dev/null
+++ b/static/img/news-placeholder.svg
@@ -0,0 +1,2 @@
+
+