Image rotation #100
Replies: 4 comments 8 replies
-
Thank you for sharing this idea. I'll add it to the list of feature candidates for future releases. Based on my initial assessment, support for image rotation would need to be built into the lightbox core, Thumbnails, and Zoom plugins. Does compatibility with Thumbnails and Zoom plugins matter in your case? April 2025 updateThe image rotation plugin is tentatively slated for v4 as proper implementation of such a plugin requires major re-engineering of the library's internal implementation. At this point, there are two prototypes compatible with v3. Neither is perfect, and both have their own limitations.
https://stackblitz.com/edit/yet-another-react-lightbox-100 Pros: highly performant
https://stackblitz.com/edit/yet-another-react-lightbox-100-1 Pros: compatible with all other plugins
|
Beta Was this translation helpful? Give feedback.
-
I achieved image rotation by customizing the render prop as shown below: Custom slide:
To handle the rotation angle, I set a local state:
And then I used the Lightbox component with the following props:
|
Beta Was this translation helpful? Give feedback.
-
@JackGamesFTW @momosetti @laichak Piggybacking on the idea proposed by @momosetti, I put together a proof-of-concept implementation that works with Thumbnails Update: this draft implementation does not work properly with Zoom plugin.
|
Beta Was this translation helpful? Give feedback.
-
An even better approach would be to set a class in the Lightbox and then apply your styles in the img element of the slider.
|
Beta Was this translation helpful? Give feedback.
-
would be cool if there was a plugin that adds two buttons to rotate a image left or right 90 degrees, incase a image is in the wrong orientation
love the package btw, moved away from another one and it was really easy to move over
Beta Was this translation helpful? Give feedback.
All reactions