filestack / filestack-js

Official Javascript SDK for the Filestack API and content ingestion system.
https://www.filestack.com
MIT License
206 stars 76 forks source link

PickerCropOptions force: true doesn't actually enforce crop before uploading #477

Open alengel opened 2 years ago

alengel commented 2 years ago

Expected Behavior

Passing in crop: { aspectRatio: 4 / 3, force: true } in the transformationOptions should enforce the crop before a user uploads the image.

Current Behavior

A user has to click SAVE and then UPLOAD before the crop gets applied. The callback onFileUploadFinished triggers long before the crop is applied, which causes the image to be uploaded uncropped and when a user then exits out of the UI (using the close button in the top right), they are left with the uncropped image (rather than the forced cropped version).

Possible Solution

The transformationOptions should apply before the image is uploaded as per the code comment here.

Steps to Reproduce (for bugs)

  1. Open the picker and select an image.
  2. Crop the image but then don't click upload / instead click the X icon in the top right
  3. You are left with an uncropped image

Additional Screenshots

  1. The picker is open and the crop is overlaid image
  2. A user clicks X in the top right
  3. The image is uncropped but should have been cropped before uploading image

Context

We use the Filestack Picker to allow users to upload an image that shows what their event is all about. To ensure the integrity of our events page, we need all images to be adhere to the same aspect ratio. When a user exits the filepicker, they shouldn't be able to bypass the forced cropping.

Your Environment