From 351485efb19115b23897465148313f3f1b0d75fa Mon Sep 17 00:00:00 2001 From: luxick Date: Wed, 21 Jan 2026 11:03:41 +0100 Subject: [PATCH] Use thumbnail/placeholder logic for imagebox --- conf/default.php | 4 + js/gallery-thumbnails.js | 3 +- src/Output.php | 95 ++++++++------------ src/ThumbnailHelper.php | 189 +++++++++++++++++++++++++++++++++++++++ syntax/image.php | 54 ++++++++--- 5 files changed, 275 insertions(+), 70 deletions(-) create mode 100644 src/ThumbnailHelper.php diff --git a/conf/default.php b/conf/default.php index 378f166..4d10087 100644 --- a/conf/default.php +++ b/conf/default.php @@ -35,3 +35,7 @@ $conf['gallery_thumb_scale'] = 1; // Local client service used by {{open>...}}. $conf['open_service_url'] = 'http://127.0.0.1:8765'; + +// Image syntax defaults +$conf['default_image_width'] = 250; +$conf['default_image_align'] = 'right'; // left|right|center diff --git a/js/gallery-thumbnails.js b/js/gallery-thumbnails.js index 6d2b3fa..1c9d1a1 100644 --- a/js/gallery-thumbnails.js +++ b/js/gallery-thumbnails.js @@ -28,7 +28,8 @@ } function init() { - var imgs = document.querySelectorAll('div.luxtools-gallery img[data-thumb-src]'); + // Handle both gallery and imagebox thumbnails + var imgs = document.querySelectorAll('div.luxtools-gallery img[data-thumb-src], div.luxtools-imagebox img[data-thumb-src]'); if (!imgs || !imgs.length) return; if ('IntersectionObserver' in window) { diff --git a/src/Output.php b/src/Output.php index c443e08..fb4555a 100644 --- a/src/Output.php +++ b/src/Output.php @@ -74,41 +74,58 @@ class Output $genThumbW = (int)max(1, (int)round($thumbW * $thumbScale)); $genThumbH = (int)max(1, (int)round($thumbH * $thumbScale)); - $placeholderUrl = DOKU_BASE . 'lib/images/blank.gif'; $placeholderId = $syntax ? trim((string)$syntax->getConf('thumb_placeholder')) : ''; - if ($placeholderId !== '' && function_exists('ml')) { - // ml() builds a fetch.php URL for a MediaManager item - $placeholderUrl = ml($placeholderId, ['w' => $genThumbW, 'h' => $genThumbH], true, '&'); - } /** @var \Doku_Renderer_xhtml $renderer */ $renderer = $this->renderer; $renderer->doc .= '