fix: thread cropOrientation into StickerCanvas (was using device orientation)
CI / test (push) Has been cancelled
CI / test (push) Has been cancelled
StickerCanvas was being passed contextOrientation (the target device's orientation), so the final composited.jpg was always sized to the device's aspect — even when the user toggled the crop tool to a different orientation. A landscape crop on a portrait device would produce a 1600x960 cropped blob, then the StickerCanvas would re-render it into a 960x1600 frame, visibly stretching the image into portrait dimensions and saving it that way. UploadView now derives an effectiveOrientation that prefers the user's chosen crop orientation (uploadStore.cropOrientation) and falls back to the device's orientation only before the crop step has run. The StickerCanvas honors that. Also adds a temporary debug log in the upload controller to verify the cropOrientation form field is arriving and being persisted — recent uploads have NULL cropOrientation despite the frontend sending it, and this log will make the next upload's payload visible. Will remove once diagnosed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -15,6 +15,7 @@ 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;
|
||||
@@ -54,6 +55,7 @@ class ImageApiController extends AbstractController
|
||||
Request $request,
|
||||
EntityManagerInterface $em,
|
||||
MessageBusInterface $bus,
|
||||
LoggerInterface $logger,
|
||||
): JsonResponse {
|
||||
$file = $request->files->get('file');
|
||||
if (!$file) {
|
||||
@@ -108,6 +110,19 @@ 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'
|
||||
|
||||
Reference in New Issue
Block a user