fix: flip portrait rotation direction so the EPD shows the photo upright
CI / test (push) Has been cancelled

The first rotation pass picked CW server-side / CCW preview-side based on
"ribbon on left" → user rotates frame 90° CCW. On hardware the photo came
out upside down, which means the user's physical rotation is the opposite
of what was assumed: 90° CW from landscape native, putting the ribbon to
the left from the user's POV but to the right from the EPD's reference
frame. The two rotation signs always need to stay opposite — flipping
both keeps the webapp preview upright while fixing the device.

Also drops the temporary upload debug log; the cropOrientation persistence
issue resolved on its own once Doctrine's metadata cache was cleared.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-06 16:10:25 -04:00
parent d31698e7b3
commit 4586079fae
3 changed files with 8 additions and 22 deletions
+2 -2
View File
@@ -253,10 +253,10 @@ class DeviceApiController extends AbstractController
$im->readImageBlob($ppm);
// The .bin is always laid out in EPD-native scan order. For portrait,
// the renderer pre-rotated the photo 90° CW; rotate -90° here so the
// the renderer pre-rotated the photo 90° CCW; rotate 90° here so the
// browser-side preview shows the photo upright.
if ($orientation === Orientation::Portrait) {
$im->rotateImage(new \ImagickPixel('white'), -90);
$im->rotateImage(new \ImagickPixel('white'), 90);
}
$im->setImageFormat('png');
-15
View File
@@ -15,7 +15,6 @@ use App\Message\RenderImageMessage;
use App\Service\ShareService;
use App\Service\TokenService;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
@@ -55,7 +54,6 @@ class ImageApiController extends AbstractController
Request $request,
EntityManagerInterface $em,
MessageBusInterface $bus,
LoggerInterface $logger,
): JsonResponse {
$file = $request->files->get('file');
if (!$file) {
@@ -110,19 +108,6 @@ class ImageApiController extends AbstractController
);
}
// TEMP debug: log what arrived in the upload form so we can diagnose
// why crop_orientation is landing as NULL despite the frontend
// claiming to send it. Remove once stable.
$logger->info('image.upload.fields', [
'image_id' => $image->getId(),
'has_cropParams' => $request->request->has('cropParams'),
'has_stickerState' => $request->request->has('stickerState'),
'has_cropOrient' => $request->request->has('cropOrientation'),
'cropOrient_raw' => $request->request->get('cropOrientation'),
'all_keys' => $request->request->keys(),
'persisted_orient' => $image->getCropOrientation()?->value,
]);
// Generate thumbnail from composited if available, otherwise from original
$thumbSrc = file_exists($storageDir . '/composited.jpg')
? $storageDir . '/composited.jpg'