diff options
| author | ilotterytea <iltsu@alright.party> | 2025-06-24 22:35:29 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-06-24 22:35:29 +0500 |
| commit | c734db91064944637e361f90ed90b30d48a7d910 (patch) | |
| tree | 641e8a7246039d98b13fa43b0d370460168a17e2 /lib/thumbnails.php | |
| parent | 2bdd40b6320d1504bb15f48242068534482c9b54 (diff) | |
feat: flash (.swf) support
Diffstat (limited to 'lib/thumbnails.php')
| -rw-r--r-- | lib/thumbnails.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/thumbnails.php b/lib/thumbnails.php index 5afc775..5e99087 100644 --- a/lib/thumbnails.php +++ b/lib/thumbnails.php @@ -10,7 +10,15 @@ function generate_image_thumbnail(string $src_path, string $dst_path, int $width $result_code = null; - exec(command: "magick $input_path -resize {$width}x{$height} -loop 0 $output_path", result_code: $result_code); + if (str_ends_with($src_path, ".swf")) { + exec(command: "swfrender $input_path -o $output_path", result_code: $result_code); + if ($result_code != 0) { + return $result_code; + } + exec(command: "magick $output_path -resize {$width}x{$height} -loop 0 $output_path", result_code: $result_code); + } else { + exec(command: "magick $input_path -resize {$width}x{$height} -loop 0 $output_path", result_code: $result_code); + } return $result_code; } |
