feat: orientation toggle and mismatch indicator in crop editor
CI / test (push) Has been cancelled

The crop tool now exposes a landscape/portrait toggle next to the
device-name label, and the canvas crop frame snaps to the chosen
aspect when toggled. Choosing an orientation that does not match
the target frame's current orientation surfaces a yellow informational
chip — purely informational, no action required, clears as soon as
the user toggles back to the matching orientation (or changes the
frame in Settings).

The chosen orientation rides along on the upload/reprocess request
as a new cropOrientation form field and is persisted on the Image
entity, so the library view and rotation logic can later surface
the same mismatch state for already-uploaded photos. Existing photos
without a stored orientation get null and are unaffected.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-06 14:45:59 -04:00
parent c387260ee7
commit 52e85703f7
11 changed files with 225 additions and 38 deletions
+11
View File
@@ -102,6 +102,11 @@ class ImageApiController extends AbstractController
if ($request->request->has('stickerState')) {
$image->setStickerState($request->request->get('stickerState'));
}
if ($request->request->has('cropOrientation')) {
$image->setCropOrientation(
Orientation::tryFrom((string) $request->request->get('cropOrientation'))
);
}
// Generate thumbnail from composited if available, otherwise from original
$thumbSrc = file_exists($storageDir . '/composited.jpg')
@@ -208,6 +213,11 @@ class ImageApiController extends AbstractController
if ($request->request->has('stickerState')) {
$image->setStickerState($request->request->get('stickerState'));
}
if ($request->request->has('cropOrientation')) {
$image->setCropOrientation(
Orientation::tryFrom((string) $request->request->get('cropOrientation'))
);
}
// Reset all rendered assets so they re-render from the new composited
foreach ($image->getRenderedAssets() as $asset) {
@@ -321,6 +331,7 @@ class ImageApiController extends AbstractController
'approvedDeviceIds' => array_values($image->getApprovedDevices()->map(fn($d) => $d->getId())->toArray()),
'cropParams' => $image->getCropParams() ? json_decode($image->getCropParams(), true) : null,
'stickerState' => $image->getStickerState() ? json_decode($image->getStickerState(), true) : null,
'cropOrientation' => $image->getCropOrientation()?->value,
];
}