viewgit/inc/functions.php:22 Function utf8_encode() is deprecated [8192]

Fix bug in display of webp thumbs 4

Chris Pollett [2023-12-29 18:Dec:th]
Fix bug in display of webp thumbs 4
Filename
src/controllers/ResourceController.php
diff --git a/src/controllers/ResourceController.php b/src/controllers/ResourceController.php
index fa9d1e43f..553e31edd 100644
--- a/src/controllers/ResourceController.php
+++ b/src/controllers/ResourceController.php
@@ -169,7 +169,14 @@ class ResourceController extends Controller implements CrawlConstants
                 }
             }
         }
-        if ( file_exists($path)) {
+        $alt_path = $path;
+        if (substr($path, -4) == 'webp') {
+            $alt_path = substr($path, 0, -4) . "jpg";
+            if (!file_exists($path) && file_exists($alt_path)) {
+                $path = $alt_path;
+            }
+        }
+        if (file_exists($path)) {
             $path = realpath($path);
             $mime_type = L\mimeType($path);
             $mime_parts = explode("/", $mime_type);
ViewGit