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
@@ -96,13 +96,14 @@ final class RenderImageMessageHandler
$imagick->autoOrient();
$imagick->cropThumbnailImage($width, $height);
// Portrait: rotate the cropped photo 90° CW so the packed .bin's row
// Portrait: rotate the cropped photo 90° CCW so the packed .bin's row
// layout matches the EPD's native 800-pixel scan order. The frame is
// physically rotated 90° CCW for portrait (ribbon on left), so the
// photo's bottom edge maps to the EPD's left column. Firmware streams
// bytes raw — no orientation awareness on-device.
// physically rotated 90° CW for portrait (ribbon on right from EPD's
// POV → on left from user's view), so the photo's top edge maps to the
// EPD's left column. Firmware streams bytes raw — no orientation
// awareness on-device.
if ($orientation === Orientation::Portrait) {
$imagick->rotateImage(new \ImagickPixel('white'), 90);
$imagick->rotateImage(new \ImagickPixel('white'), -90);
}
$imagick->setImageColorspace(\Imagick::COLORSPACE_SRGB);