uploadcare / blocks

Stack-agnostic library for uploading, processing, and editing images on-the-fly
https://uploadcare.com/docs/file-uploader/
MIT License
61 stars 12 forks source link

Crop by aspect ratio in image editor #666

Open rawstream opened 1 month ago

rawstream commented 1 month ago

Is your feature request related to a problem? Please describe. I would like to use the Built-in image editor by passing a cdnUrl that contains a crop operation by aspect ratio. The operation is ignored and the editor does show the uncropped image instead.

image

Describe the solution you'd like The Built-in image editor supports 'Crop by aspect ratio'.

p4m commented 1 month ago

This would be great if this is resolved.

nd0ut commented 1 month ago

Hello! Thanks for feedback.

I have two questions:

p4m commented 1 month ago
  1. With the 'freeform' feature coming in the near future (mentioned by Alex via a personal email message on May 16th), I would expect that the user can change the aspect ratio. When offered different aspect ratios to the user. See below the feature in the Uploadcare docs. image
  2. I personally would expect that the crop operation is done like it is now, in the previous widget: cropped in the center of the image, based on the aspect ratio.
rawstream commented 1 month ago

Hi @nd0ut , Thanks for your response.

Should the editor enforce a fixed crop aspect ratio and prevent changes to the aspect ratio during editing?

I don't think this should be the default behaviour.

Do you specifically need the resulting URL to contain /crop/16:9/ operation? Would it be acceptable if the crop operation is absolutely positioned in the output URL? For instance, if you provide a URL with /crop/1:1/ and receive a result with /crop/1000x1000/100,0/?

It would definitely be acceptable if the crop operation is absolutely formatted in the output URL. The main issue is that the editor currently does not recognize /crop/16:9. The format of the output URL after editing doesn't really matter.