git.shiar.nl
/
minimedit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
686de24
)
nieuws: find article image to append on page
author
Mischa POSLAWSKY
<perl@shiar.org>
Tue, 31 Jul 2018 22:36:57 +0000
(
00:36
+0200)
committer
Mischa POSLAWSKY
<perl@shiar.org>
Tue, 31 Jul 2018 22:36:57 +0000
(
00:36
+0200)
nieuws.inc.php
patch
|
blob
|
history
diff --git
a/nieuws.inc.php
b/nieuws.inc.php
index 3f3f16391f6bf6c0bc8cc5276b558a697dbf6abc..454c91c023a9f457da5d3b735e4abb313d82495d 100644
(file)
--- a/
nieuws.inc.php
+++ b/
nieuws.inc.php
@@
-14,6
+14,15
@@
function shownewsdate($url)
]));
}
]));
}
+function shownewsimage($url)
+{
+ foreach (['jpg', 'png'] as $ext) {
+ if (file_exists("$url.$ext")) {
+ return "$url.$ext";
+ }
+ }
+}
+
function shownewsarticle($url, $link = TRUE, $title = NULL)
{
$html = ob_get_clean();
function shownewsarticle($url, $link = TRUE, $title = NULL)
{
$html = ob_get_clean();
@@
-27,6
+36,17
@@
function shownewsarticle($url, $link = TRUE, $title = NULL)
getoutput([1 => ' <small class="date">'.$date.'</small>']),
$url
);
getoutput([1 => ' <small class="date">'.$date.'</small>']),
$url
);
+
+ if (!$link and $image = shownewsimage($url)) {
+ global $Place;
+ $Place['image'] = "https://lijtweg.nl/thumb/600x/".$image;
+ ob_start();
+ print '[[1]]';
+ $html .= getoutput([
+ 1 => sprintf("\n".'<p><img src="%s" /></p>', "/thumb/640x/".$image),
+ ]);
+ }
+
return preg_replace('{<h2>(.*?)</h2>}', $title, $html);
}
return preg_replace('{<h2>(.*?)</h2>}', $title, $html);
}