From fdefcffe0e4729e8dc74eb9c8b925d67fff5da1e Mon Sep 17 00:00:00 2001 From: plegall Date: Fri, 25 Oct 2024 10:25:47 +0200 Subject: [PATCH] (cp cdd4d3d2b) Only count PDF pages for PDF files Fixes #2239 --- picture.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/picture.php b/picture.php index 38416c0a9..153f6276b 100644 --- a/picture.php +++ b/picture.php @@ -971,12 +971,14 @@ SELECT id, name, permalink } } -$template->assign( - array( - 'PDF_VIEWER_FILESIZE_THRESHOLD' => $conf['pdf_viewer_filesize_threshold']*1024, - 'PDF_NB_PAGES' => count_pdf_pages($picture['current']['path']) - ) -); +if (str_ends_with(strtolower($picture['current']['file']), "pdf" )) { + $template->assign( + array( + 'PDF_VIEWER_FILESIZE_THRESHOLD' => $conf['pdf_viewer_filesize_threshold']*1024, + 'PDF_NB_PAGES' => count_pdf_pages($picture['current']['path']) + ) + ); +} // maybe someone wants a special display (call it before page_header so that // they can add stylesheets) @@ -1044,4 +1046,4 @@ else //------------------------------------------------------------ log informations pwg_log($picture['current']['id'], 'picture'); include(PHPWG_ROOT_PATH.'include/page_tail.php'); -?> \ No newline at end of file +?>