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

Fix bug in display of webp thumbs 3

Chris Pollett [2023-12-29 17:Dec:th]
Fix bug in display of webp thumbs 3
Filename
src/library/processors/VideoProcessor.php
diff --git a/src/library/processors/VideoProcessor.php b/src/library/processors/VideoProcessor.php
index f6e77a26e..b8053fbb5 100644
--- a/src/library/processors/VideoProcessor.php
+++ b/src/library/processors/VideoProcessor.php
@@ -126,8 +126,8 @@ class VideoProcessor extends PageProcessor
         if(!function_exists("exec") || !C\nsdefined("FFMPEG")) {
             return;
         }
-        if (file_exists("$thumb_folder/$file_name.jpg")) {
-            @unlink("$thumb_folder/$file_name.jpg");
+        if (file_exists("$thumb_folder/$file_name.webp")) {
+            @unlink("$thumb_folder/$file_name.webp");
         }
         if (file_exists("$thumb_folder/$file_name.gif")) {
             @unlink("$thumb_folder/$file_name.gif");
@@ -143,7 +143,7 @@ class VideoProcessor extends PageProcessor
             $thumb_time < $duration; $thumb_num++,
             $thumb_time += $thumb_interval) {

-            $out_name = sprintf("$thumb_folder/$file_name-"."%'.02d".".jpg",
+            $out_name = sprintf("$thumb_folder/$file_name-"."%'.02d".".webp",
                 $thumb_num);
             $png_input .= " -i \"$out_name\" ";
             $make_static_thumb =
@@ -156,19 +156,19 @@ class VideoProcessor extends PageProcessor
         if ($num_thumbs > 1) {
             $make_animated_thumb = C\FFMPEG . " -hide_banner -loglevel ".
                 "panic -framerate 1 -pattern_type glob " .
-                "-i '$thumb_folder/$file_name-*.jpg' -y  " .
+                "-i '$thumb_folder/$file_name-*.webp' -y  " .
                 "  \"$thumb_folder/$original_filename.gif\"";
             exec($make_animated_thumb);
             clearstatcache("$thumb_folder/$original_filename.gif");
         }
-        $jpegs = glob("$thumb_folder/$file_name-*.jpg");
-        foreach ($jpegs as $jpeg) {
-            if ($jpeg == "$thumb_folder/$file_name-00.jpg") {
-                rename($jpeg, "$thumb_folder/$original_filename.jpg");
+        $webps = glob("$thumb_folder/$file_name-*.webp");
+        foreach ($webps as $webp) {
+            if ($webp == "$thumb_folder/$file_name-00.webp") {
+                rename($webp, "$thumb_folder/$original_filename.webp");
             } else {
-                unlink($jpeg);
+                unlink($webp);
             }
         }
-        clearstatcache("$thumb_folder/$original_filename.jpg");
+        clearstatcache("$thumb_folder/$original_filename.webp");
     }
 }
ViewGit