From 590ad9d7e327086fea5c4d4a7adc6b0ff5f93696 Mon Sep 17 00:00:00 2001 From: Terranom674 Date: Sun, 16 Aug 2026 22:45:41 +0200 Subject: [PATCH] Improve camera title detection --- include/batch_titles.inc.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/batch_titles.inc.php b/include/batch_titles.inc.php index 9ec5c14..b24c3b1 100644 --- a/include/batch_titles.inc.php +++ b/include/batch_titles.inc.php @@ -212,15 +212,18 @@ function bratonien_tools_batch_titles_is_replaceable($image) return true; } - $file = (string)($image['file'] ?? ''); + $file = trim((string)($image['file'] ?? '')); $file_base = pathinfo($file, PATHINFO_FILENAME); - if ($file_base !== '' && strcasecmp($title, $file_base) === 0) + if ( + ($file !== '' && strcasecmp($title, $file) === 0) + || ($file_base !== '' && strcasecmp($title, $file_base) === 0) + ) { return true; } return (bool)preg_match( - '/^(?:DSC[F]?|IMG|PXL|DCIM|SAM|PIC|PHOTO|IMAGE)[-_ ]?\d+(?:[-_ ].*)?$/i', + '/^(?:DSC[F]?|IMG|PXL|DCIM|SAM|PIC|PHOTO|IMAGE)[-_ ]?\d+(?:[-_ ].*)?(?:\.[A-Z0-9]{2,5})?$/i', $title ); }