nieuws: alternate cover image for .groot file name v3.9
authorMischa POSLAWSKY <perl@shiar.org>
Sun, 28 Apr 2019 23:16:31 +0000 (01:16 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Sun, 28 Apr 2019 23:25:52 +0000 (01:25 +0200)
Assume any picture with such extension has a corresponding version preferred
as article thumbnail (cropped for smaller sizes).

nieuws.inc.php

index 1a68993f42bcd2387ad5e14257d5059c149d41f6..40432a9c22cfc6aa1411ac866e6cf9e5e577ac9a 100644 (file)
@@ -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
+               );
        }
 }