Image type resizing in a repeatable field ? #257
Replies: 1 comment
-
To handle the setImageAttribute for an image subfield within a repeatable field in Backpack, and to resize the image, you can follow these steps: First, ensure you have set up the repeatable field with an image subfield correctly in your CRUD controller:
In your model, you'll need to create a mutator for the images attribute. Since the repeatable field stores data as JSON, you'll need to decode it, process each image, and then encode it back to JSON.
This implementation will resize each image in the repeatable field to 300x300 pixels while maintaining the aspect ratio. You can adjust the dimensions as needed. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
In a repeatable field and specifically in a subfield type image, how can we handle the setImageAttribute ?
I would like to resize image
Regards
Beta Was this translation helpful? Give feedback.
All reactions