From 6a647097bd5b175b2ad8f76ec38ad29dfd297ffd Mon Sep 17 00:00:00 2001 From: w3houde Date: Wed, 12 Aug 2026 00:41:49 +0700 Subject: [PATCH] Fix #39355 load images.lib.php before image_format_supported in API (#39462) The POST /documents endpoint with generateThumbs=1 called image_format_supported() after requiring only files.lib.php, but that function is defined in images.lib.php, which was never included on this path. The call raised a fatal error and the request returned a bare HTTP 500 with no JSON body. Add the missing require_once. Signed-off-by: Dolicraft Co-authored-by: Dolicraft --- htdocs/api/class/api_documents.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 436b08351a7..2887e90b498 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -1061,6 +1061,7 @@ class Documents extends DolibarrApi if (is_object($object) && $generateThumbs) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; // image_format_supported() is defined here if (image_format_supported($dest_file)) { $object->addThumbs($dest_file); }