From: Mischa POSLAWSKY Date: Sun, 28 Apr 2019 23:16:31 +0000 (+0200) Subject: nieuws: alternate cover image for .groot file name X-Git-Tag: v3.9^0 X-Git-Url: http://git.shiar.net/minimedit.git/commitdiff_plain/81b908af157b8580cca92046dd4ad8772c61e4fb nieuws: alternate cover image for .groot file name Assume any picture with such extension has a corresponding version preferred as article thumbnail (cropped for smaller sizes). --- diff --git a/nieuws.inc.php b/nieuws.inc.php index 1a68993..40432a9 100644 --- a/nieuws.inc.php +++ b/nieuws.inc.php @@ -113,7 +113,10 @@ class ArchiveArticle function thumb($size = '300x') { if (!$this->image or $this->image[0] !== '/') return; - return preg_replace('{^(?:/thumb/[^/]*)?}', "thumb/$size", $this->image); + return preg_replace( + ['{^(?:/thumb/[^/]*)?}', '/\.groot(?=\.\w+$)/'], ["thumb/$size", ''], + $this->image + ); } }