summaryrefslogtreecommitdiff
path: root/public/upload.php
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-06-25 00:13:02 +0500
committerilotterytea <iltsu@alright.party>2025-06-25 00:13:02 +0500
commit17cdae613d339d31aacabfd232fdd9f67bea6c3a (patch)
tree8824c7c0e55bdec8d1eaf129d97257b3fbbfede9 /public/upload.php
parentc734db91064944637e361f90ed90b30d48a7d910 (diff)
feat: custom swf parser because swftools is obsolete
Diffstat (limited to 'public/upload.php')
-rw-r--r--public/upload.php7
1 files changed, 4 insertions, 3 deletions
diff --git a/public/upload.php b/public/upload.php
index c5a2e7e..15a66d2 100644
--- a/public/upload.php
+++ b/public/upload.php
@@ -207,7 +207,7 @@ try {
if (
FILE_THUMBNAILS && (
(
- (str_starts_with($file_data['mime'], 'image/') || $file_data['mime'] == 'application/x-shockwave-flash') &&
+ str_starts_with($file_data['mime'], 'image/') &&
$thumbnail_error = generate_image_thumbnail(
FILE_UPLOAD_DIRECTORY . "/{$file_id}.{$file_data['extension']}",
FILE_THUMBNAIL_DIRECTORY . "/{$file_id}.webp",
@@ -255,8 +255,9 @@ try {
} else if (str_starts_with($file_data['mime'], 'text/')) {
$file_data['metadata']['line_count'] = intval(trim(shell_exec('wc -l < ' . escapeshellarg($file_path))));
} else if ($file_data['mime'] == 'application/x-shockwave-flash') {
- $file_data['metadata']['width'] = intval(substr(trim(shell_exec("swfdump -X $file_path_escaped")), 3));
- $file_data['metadata']['height'] = intval(substr(trim(shell_exec("swfdump -Y $file_path_escaped")), 3));
+ [$width, $height] = parse_swf_file($file_path);
+ $file_data['metadata']['width'] = $width;
+ $file_data['metadata']['height'] = $height;
}
$file_data['urls'] = [