Commit a410dac
fix: support text rotation in collage zone mode and respect admin settings
Previously, the text rotation configured in the admin panel was ignored
when using collage layouts with zone-based text alignment
(text_alignment.mode = "zone"). The zone rendering in Image::applyTextInZone()
always passed rotation=0 to imagettftext(), and Collage.php allowed JSON
layout files to override the admin rotation value.
Changes in Collage.php:
- Zone-based text alignment from layout JSON is now only applied when
"Allow layout selection" (collageAllowSelection) is enabled. When
disabled, admin panel coordinates (locationx, locationy, rotation)
are used directly via legacy rendering
- Admin rotation value always takes priority over JSON layout rotation
in both zone mode and legacy mode when layout selection is active
- text_disabled from JSON is also only honored when layout selection
is enabled
Changes in Image.php:
- applyTextInZone() now applies the configured rotation angle to
imagettftext() instead of hardcoding 0
- Rotated text lines are stacked perpendicular to the text direction
using trigonometric offset calculation (sin/cos) so lines appear
properly aligned at any angle
- Each line is individually centered along the text direction based on
its width relative to the widest line
- The entire rotated text block is precisely centered within the text
zone by calculating the actual bounding box of all rendered glyphs
using imagettfbbox() with the rotation angle, then computing the
offset needed for proper horizontal (align) and vertical (valign)
zone alignment
- Admin line spacing (linespace) is respected as minimum distance
between lines, preventing text from collapsing when auto-fit reduces
the font size
- Removed outdated comment "currently only 0 supported" from
textZoneRotation property
Closes #14331 parent 5bfd8a2 commit a410dac
2 files changed
+121
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
| 206 | + | |
| 207 | + | |
206 | 208 | | |
207 | 209 | | |
208 | 210 | | |
209 | | - | |
| 211 | + | |
210 | 212 | | |
211 | 213 | | |
212 | 214 | | |
| |||
223 | 225 | | |
224 | 226 | | |
225 | 227 | | |
226 | | - | |
| 228 | + | |
227 | 229 | | |
228 | | - | |
| 230 | + | |
229 | 231 | | |
230 | 232 | | |
231 | 233 | | |
| |||
238 | 240 | | |
239 | 241 | | |
240 | 242 | | |
241 | | - | |
242 | | - | |
243 | | - | |
| 243 | + | |
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
| 141 | + | |
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| |||
986 | 986 | | |
987 | 987 | | |
988 | 988 | | |
989 | | - | |
990 | | - | |
| 989 | + | |
| 990 | + | |
991 | 991 | | |
992 | 992 | | |
993 | 993 | | |
| |||
1009 | 1009 | | |
1010 | 1010 | | |
1011 | 1011 | | |
1012 | | - | |
1013 | | - | |
1014 | | - | |
1015 | | - | |
1016 | | - | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
1017 | 1015 | | |
1018 | | - | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
1019 | 1077 | | |
1020 | 1078 | | |
1021 | | - | |
| 1079 | + | |
1022 | 1080 | | |
1023 | 1081 | | |
1024 | | - | |
| 1082 | + | |
1025 | 1083 | | |
1026 | 1084 | | |
1027 | 1085 | | |
1028 | | - | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
1029 | 1100 | | |
1030 | 1101 | | |
1031 | 1102 | | |
1032 | | - | |
1033 | | - | |
1034 | | - | |
1035 | | - | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
1036 | 1107 | | |
1037 | | - | |
1038 | | - | |
1039 | | - | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
1040 | 1136 | | |
1041 | 1137 | | |
1042 | 1138 | | |
| |||
0 commit comments