@@ -198,6 +198,11 @@ public static function getCollageConfigPath(string $collageLayout, string $pictu
198198 return self ::getLegacyCollageConfigPath ($ layoutId , $ pictureOrientation );
199199 }
200200
201+ private static function isPrivateCollageConfigPath (string $ absolutePath ): bool
202+ {
203+ return str_starts_with (PathUtility::toProjectRelative ($ absolutePath ), 'private/ ' );
204+ }
205+
201206 public static function createCollage (array $ config , array $ srcImagePaths , string $ destImagePath , ?ImageFilterEnum $ filter = null , ?CollageConfig $ c = null ): bool
202207 {
203208 if ($ c === null ) {
@@ -212,6 +217,8 @@ public static function createCollage(array $config, array $srcImagePaths, string
212217 self ::$ pictureOrientation = $ c ->collageOrientation ;
213218
214219 $ collageConfigFilePath = self ::getCollageConfigPath ($ c ->collageLayout , self ::$ pictureOrientation );
220+ $ collageConfigIsPrivate = $ collageConfigFilePath !== null
221+ && self ::isPrivateCollageConfigPath ($ collageConfigFilePath );
215222
216223 // Save the original admin setting for text on collage
217224 $ adminTextOnCollageEnabled = $ c ->textOnCollageEnabled ;
@@ -274,13 +281,15 @@ public static function createCollage(array $config, array $srcImagePaths, string
274281 $ c ->textOnCollageLinespace = isset ($ collageJson ['text_linespace ' ]) ? $ collageJson ['text_linespace ' ] : $ c ->textOnCollageLinespace ;
275282 }
276283
277- // JSON layout can only disable or customize text if admin has enabled it
278- // Zone-based text alignment is only applied when layout selection is allowed ,
279- // otherwise admin panel coordinates (locationx, locationy, rotation) are used
284+ // JSON layout can only disable or customize text if admin has enabled it.
285+ // Layouts from private/ always respect their JSON text config ,
286+ // other layouts require allow_selection.
280287 if ($ adminTextOnCollageEnabled === 'enabled ' ) {
281- if ($ c ->collageAllowSelection && isset ($ collageJson ['text_disabled ' ]) && $ collageJson ['text_disabled ' ] === true ) {
288+ $ allowJsonTextOverrides = $ c ->collageAllowSelection || $ collageConfigIsPrivate ;
289+
290+ if ($ allowJsonTextOverrides && isset ($ collageJson ['text_disabled ' ]) && $ collageJson ['text_disabled ' ] === true ) {
282291 $ c ->textOnCollageEnabled = 'disabled ' ;
283- } elseif ($ c -> collageAllowSelection && isset ($ collageJson ['text_alignment ' ]) && is_array ($ collageJson ['text_alignment ' ])) {
292+ } elseif ($ allowJsonTextOverrides && isset ($ collageJson ['text_alignment ' ]) && is_array ($ collageJson ['text_alignment ' ])) {
284293 $ ta = $ collageJson ['text_alignment ' ];
285294 $ c ->textOnCollageEnabled = 'enabled ' ;
286295
@@ -298,8 +307,11 @@ public static function createCollage(array $config, array $srcImagePaths, string
298307 $ c ->textZoneAlign = $ ta ['align ' ] ?? 'center ' ;
299308 $ c ->textZoneValign = $ ta ['valign ' ] ?? 'middle ' ;
300309 $ c ->textZoneRotation = $ c ->textOnCollageRotation ;
310+ if ($ collageConfigIsPrivate && isset ($ ta ['rotation ' ])) {
311+ $ c ->textZoneRotation = (int ) $ ta ['rotation ' ];
312+ }
301313
302- // In zone mode: ignore admin X/Y values, use admin rotation
314+ // In zone mode: ignore admin X/Y values
303315 // Keep admin font, color, text lines, fontSize (as start), lineHeight (as factor)
304316 } else {
305317 // Legacy mode: calculate X/Y position based on alignment
@@ -312,7 +324,9 @@ public static function createCollage(array $config, array $srcImagePaths, string
312324 $ c ->textOnCollageFontSize = (int ) Helper::doMath (str_replace (array_keys ($ replace ), array_values ($ replace ), $ ta ['fontSize ' ]));
313325 }
314326
315- // Admin rotation is always used, JSON rotation is ignored
327+ if ($ collageConfigIsPrivate && isset ($ ta ['rotation ' ])) {
328+ $ c ->textOnCollageRotation = (int ) $ ta ['rotation ' ];
329+ }
316330
317331 if (isset ($ ta ['lineHeight ' ])) {
318332 $ c ->textOnCollageLinespace = (int ) Helper::doMath (str_replace (array_keys ($ replace ), array_values ($ replace ), $ ta ['lineHeight ' ]));
0 commit comments