- Issue was unassigned.
- 🇫🇷France Grimreaper France 🇫🇷
Hi,
I finally got time to give a look at this issue.
I confirm this is not a problem related to Entity Share but the Crop API → module:
✨ JSON API integration Active
So solution will both work for Focal Point and Manual crop or any kind of crop.
As crop type is a config entity, it should be the same between your client and server website.
As you mentioned the problem is that there is no proper relationship between a crop content entity and the image file entity it is applied on.
And there is also that in the attributes of this content entity, there is
"entity_id":1
, which is an ID and not an UUID.I think what could be done as a workaround to automatically import the crop:
1. in the image field output add information of the (or the multiples) crop content entity JSON:API URLs. How?
- With a normalizer like you proposed?
- or maybe like in comment #2890651-14: JSON API integration →I think the place for this is in the Crop API module.
2. add an event subscriber on RelationshipFieldValueEvent or an import plugin processor that will read this or these URLs to import automatically the crop content entity.
But the crop content entity would need to be prepared:
3. create a field enhancer to transform the "entity_id" attributes into a UUID and the opposite in doTransform().This field enhancer could reside either in Entity Share or in the Crop API module. Maybe better in Crop API.
4. should the uri attributes on crop content entity be ignored or will require special treatment too? will the physical file be regenerated automatically?
I will also ping in the other issue to ask for feedbacks.
- 🇺🇸United States pbabin
We're looking at needing something like this as well. Has anyone been able to successfully do this and can share their code? We're just using crop api with image widget crop. I see in the database all the points that @maxpah and @grimreaper are making so I think we should be able to pass the crop information along; however, I am at a loss of where to start. It doesn't look like there is any traction on the crop api side. So is it advisable to add these modifications into our own module and try the import?
Any guidance to point me in the right direction is greatly appreciated. Entity share is such an amazing tool and our organization is extremely grateful for all that it does!
Thank you in advance.
Hello @pbabin,
In one of our project we faced similar problem.
The solution was implemented using custom module to bind another extra field which stores the crop positions data.
Once the data is synced we wrote code to use those field value and apply crop to image.