Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • kristian schneider 190 posts 351 karma points
    Jun 17, 2022 @ 13:01
    kristian schneider
    0

    Create imagecropper content via content management api

    Hi Peeps.

    We are migrating content from an old site (7.15.4) into heartcore. The current content structure is a bit convoluted so we've opted to bake our own migration engine where we push content into heartcore via the API.

    We've hit a wall with imagecropper content.

    We've tried to send it over as the following json

    {
                'src': '/media/bzhjvzvv/65535_51788076777_1ada857001_h_1200_800_nofilter.jpg',
    
            'focalPoint': {
                'left': 0.6352043073989169,
                'top': 0.5203080737681225
    
            },
            'crops': [{
                'alias': 'Banner',
                'width': 800,
                'height': 200,
                'coordinates': null
    
            }, {
                'alias': 'Card',
                'width': 200,
                'height': 280,
                'coordinates': null
    
            }]
        }
    

    But It does not seem to work. Any ideas? Perhaps even an example on how you've done it.

    Kind regards Kristian

  • Lindow 154 posts 1301 karma points
    Jun 17, 2022 @ 16:43
    Lindow
    0

    Hi there.

    This looks like the correct format for a cropped media but I don't think that you need to add the crops in the body, as I believe that they should be created automatically once the media file is uploaded to the backoffice.

    You can check out our docs here - https://our.umbraco.com/documentation/Umbraco-Heartcore/API-Documentation/Content-Management/content/#create-content-with-files and you're always welcome to reach out to our support.

    It'll definitely be easier to help you if they're able to see what you're working with etc. :)

  • kristian schneider 190 posts 351 karma points
    Jun 20, 2022 @ 06:58
    kristian schneider
    100

    We got it working with the following:

    {
    "name": {
        "$invariant": "Node name"
    },
    "contentTypeAlias": "article",
    "heroImage": {
        "$invariant": {
                "src": "/media/bzhjvzvv/65535_51788076777_1ada857001_h_1200_800_nofilter.jpg",
    
            "focalPoint": {
                'left': 0.6352043073989169,
                'top': 0.5203080737681225
    
            }
        }
    }
    

    With a PUT request at: https://api.umbraco.io/content/GUID_ID

  • Lindow 154 posts 1301 karma points
    Jun 20, 2022 @ 07:42
    Lindow
    0

    Awesome to hear that :)

Please Sign in or register to post replies

Write your reply to:

Draft