cloudinary-community / next-cloudinary

⚡️ High-performance image delivery and uploading at scale in Next.js powered by Cloudinary.
https://next.cloudinary.dev
MIT License
251 stars 70 forks source link

[Feature] Support x & y coordinates on crop #481

Closed rafaponieman closed 1 month ago

rafaponieman commented 4 months ago

Feature Request

From all that I have researched, there currently doesn't seem to be a way to support x & y origin coordinates for the crop operation. I tried to work around it but it seems it would involve working on both this library and @cloudinary-util.

In my use case, I have full images that have been cropped by users, giving me x, y, width & height percentages. Working directly with the Cloudinary URLs works fine as long as I specify the percentages as percentage / 100 (x: 50% would be x_0.5).

Thank you!

github-actions[bot] commented 1 month ago

:tada: This issue has been resolved in version 6.12.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

colbyfayock commented 1 month ago

sorry for the delay here @rafaponieman - should be available on 6.12.0

ex:

crop={{
  type: 'crop',
  width: 400,
  height: 400,
  x: 80,
  y: 350,
  gravity: 'north_east',
  source: true
}}

it accepts a string so you should also be able to pass in your percentage values