Issue 2331 fix large file sync timeouts

Put `getimagesize` behind a mimetype check, so it doesn't waste processing
time on large files like videos that are incompatible.
This commit is contained in:
Ben Becker
2025-02-28 17:51:51 -08:00
committed by Pierrick Le Gall
parent 0cb6914e5a
commit 24c51f7225
+10 -2
View File
@@ -188,7 +188,13 @@ function get_sync_metadata($infos)
$file = original_to_representative($file, $infos['representative_ext']);
}
if (function_exists('mime_content_type') && in_array(mime_content_type($file), array('image/svg+xml', 'image/svg')))
if (function_exists('mime_content_type'))
{
$mime_type = mime_content_type($file);
if (str_starts_with($mime_type, 'image/'))
{
if (in_array($mime_type, array('image/svg+xml', 'image/svg')))
{
$xml = file_get_contents($file);
@@ -214,12 +220,14 @@ function get_sync_metadata($infos)
$infos['height'] = round(explode(" ", $vb)[3]);
}
}
// Only get image size for images. This cuts significant time with large videos.
if ($image_size = @getimagesize($file))
{
$infos['width'] = $image_size[0];
$infos['height'] = $image_size[1];
}
}
}
if ($is_tiff)
{