X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/b95195ed4540a07ac0f31c363101698ada841d67..a332183ffe74a1580779a5eeeeb7dbe02a398075:/nieuws.inc.php diff --git a/nieuws.inc.php b/nieuws.inc.php index 8af5694..454c91c 100644 --- 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(); @@ -25,8 +34,19 @@ function shownewsarticle($url, $link = TRUE, $title = NULL) $title = sprintf( $link ? '

%s

' : '

%s

', getoutput([1 => ' '.$date.'']), - preg_replace('/\.html$/', '', $url) + $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".'

', "/thumb/640x/".$image), + ]); + } + return preg_replace('{

(.*?)

}', $title, $html); } @@ -37,7 +57,7 @@ function shownews($input, $limit = 1000) print "
"; ob_start(); include $url; - print shownewsarticle($url); + print shownewsarticle(preg_replace('/\.html$/', '', $url)); print "
\n\n"; if (--$limit <= 0) break;