From 0ac128d6a2df3a84f49a4d86cfbf501bbbb52a43 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Sun, 1 Jun 2025 00:01:49 +0400 Subject: feat: file thumbnails --- lib/thumbnails.php | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 lib/thumbnails.php (limited to 'lib/thumbnails.php') diff --git a/lib/thumbnails.php b/lib/thumbnails.php new file mode 100644 index 0000000..5afc775 --- /dev/null +++ b/lib/thumbnails.php @@ -0,0 +1,41 @@ +&1"; + $magick_command = "magick $folder_path/frames_*.png -loop 0 -delay 60 -resize {$width}x{$height} $output_path 2>&1"; + + exec($ffmpeg_command, $ffmpeg_output, $ffmpeg_result_code); + exec($magick_command, $magick_output, $magick_result_code); + + array_map('unlink', array_filter((array) glob("$folder_path/*.*"))); + rmdir($folder_path); + + return $ffmpeg_result_code === 0 && $magick_result_code === 0 ? 0 : -1; +} \ No newline at end of file -- cgit v1.2.3