Media export format when cropping is used

Created on 5 May 2025, 10 days ago

I had originally posted this in the issue queue for the content_sync project, but after doing some more logic tracing I now think it may actually have more to do with this one, so I'm replicating my comment here. Also, this appears somewhat related to other issues posted here, but I'm not sure it's precisely the same, and I apologize if I'm being unnecessarily redundant.

We have nodes with paragraphs, which themselves have fields configured to use the media_library_media_modify plugin widgets, which in turn are enabling "contextual cropping" via crop and media_contextual_crop.

When all this exported, we get a snippet of yaml which, unlike more conventional media reference fields, look like this:

field_photo_crop:
          -
            target_id: '3288'
            overwritten_property_map: '{"path":[{"alias":"","pid":null}],"field_media_image":[{"image_crop":{"crop_wrapper":{"crop_1040_x_427":{"crop_container":{"values":{"crop_applied":"1","x":"0","y":"976","width":"3262","height":"1339"},"reset":"Reset crop"}}},"file-uri":"public:\/\/2024-10\/some-file.jpg","file-id":"111111"}}]}'

Since this contains only the target_id, rather than all the nice URI stuff and the related asset, it's not going to migrate. Presumably (though I haven't tested this yet), it might import "as is", but of course we can't know that we won't be overwriting an existing target_id in the destination environment.

Obviously, this has much more to do with those other plugins, but I'm wondering if there are any quick thoughts here on how to account for this. Even though the other plugins are causing the issue, I think the solution is going to wind up being hooking/extending this one, and I'd appreciate any guidance in that area.

Addendum: An alternative question might be: is it possible to adjust the import method to account for and correct possible target ID overwrites?

Current followup: My current thought is to extend your ImageItemNormalizer class to alter the way the data is collected and exported (and of course imported).

πŸ’¬ Support request
Status

Active

Version

1.4

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States datawench

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024