+
+ =$languageService->translate('testTextPositions')?>
+
+
+
+ Orientation: =htmlspecialchars($orientation)?>
+
+
+
+ Text-Zone (mode="zone")
+
+
+
+
+';
+ echo '
' . htmlspecialchars($layout) . '
';
+ echo '
Nicht verfuegbar fuer ' . $orientation . '
';
+ echo '
';
+ continue;
+ }
+
+ // Korrekte Bildanzahl berechnen (fuer 2x Layouts: count/2)
+ $calcResult = Collage::calculateLimit($testConfig['collage']);
+ $imageCount = $calcResult['limit'];
+
+ // WICHTIG: limit in Config setzen damit CollageConfigFactory den richtigen Wert verwendet
+ $testConfig['collage']['limit'] = $imageCount;
+
+ // Template laden fuer Zone-Visualisierung
+ $json = json_decode(file_get_contents($templatePath), true);
+
+ $w = $orientation === 'portrait' ? 600 : 800;
+ $h = $orientation === 'portrait' ? 800 : 600;
+
+ for ($i = 0; $i < $imageCount; $i++) {
+ $tmp[] = createTestImage($colors[$i % 4], $w, $h, $layout . '_' . $i . '_' . $orientation);
+ }
+
+ $dest = __DIR__ . '/../data/images/preview_' . $layout . '_' . $orientation . '.jpg';
+
+ $ok = Collage::createCollage($testConfig, $tmp, $dest);
+
+ // Zone visualisieren falls vorhanden
+ $hasZone = false;
+ if ($ok && file_exists($dest)) {
+ if (isset($json['text_alignment']) && ($json['text_alignment']['mode'] ?? '') === 'zone') {
+ $hasZone = true;
+ $img = imagecreatefromjpeg($dest);
+
+ if ($img) {
+ $width = imagesx($img);
+ $height = imagesy($img);
+ $ta = $json['text_alignment'];
+
+ // Zone-Koordinaten berechnen
+ $rep = ['x' => $width, 'y' => $height];
+ $zoneX = isset($ta['x']) ? (int) Helper::doMath(str_replace(array_keys($rep), array_values($rep), (string)$ta['x'])) : 0;
+ $zoneY = isset($ta['y']) ? (int) Helper::doMath(str_replace(array_keys($rep), array_values($rep), (string)$ta['y'])) : 0;
+ $zoneW = isset($ta['w']) ? (int) Helper::doMath(str_replace(array_keys($rep), array_values($rep), (string)$ta['w'])) : 0;
+ $zoneH = isset($ta['h']) ? (int) Helper::doMath(str_replace(array_keys($rep), array_values($rep), (string)$ta['h'])) : 0;
+
+ // Magenta Zone zeichnen
+ imagesavealpha($img, true);
+ $fill = imagecolorallocatealpha($img, 255, 0, 255, 80);
+ $border = imagecolorallocate($img, 255, 255, 255);
+ imagefilledrectangle($img, $zoneX, $zoneY, $zoneX + $zoneW, $zoneY + $zoneH, $fill);
+ imagerectangle($img, $zoneX, $zoneY, $zoneX + $zoneW, $zoneY + $zoneH, $border);
+ imagerectangle($img, $zoneX + 1, $zoneY + 1, $zoneX + $zoneW - 1, $zoneY + $zoneH - 1, $border);
+
+ imagejpeg($img, $dest, 90);
+ imagedestroy($img);
+ }
+ }
+ }
+
+ echo '
';
+ echo '
' . htmlspecialchars($layout) . '
';
+ if ($ok && file_exists($dest)) {
+ echo '
) . '?' . time() . ')
';
+ $size = getimagesize($dest);
+ echo '
' . $size[0] . 'x' . $size[1];
+ if ($hasZone) {
+ echo ' | Zone';
+ }
+ echo '
';
+ } else {
+ echo '
Fehler beim Erstellen
';
+ }
+ echo '
';
+
+ foreach ($tmp as $f) {
+ @unlink($f);
+ }
+}
+?>
+
+