umbraco / Umbraco.Cloud.Issues

Public issue tracker for Umbraco Cloud
26 stars 2 forks source link

Heartcore : Mediapicker crop url is different than crop url from media item #350

Closed dawoe closed 2 years ago

dawoe commented 3 years ago

Generating a crop url directly from a mediapicker generates a different url compared to generating a cropurl on the media item directly using the GraphQL Api.

Reproduction

Steps to reproduce

Create a doctype and add a mediapicker to it. Create a node using the doctype and select a image from the media library.

Go in to the GraphQL playground and execute the following query.

query {
  homepage(url: "/en/homepage/") {
    headerImage {     
      url(width: 1346, height: 546),
      ... on Image {
        umbracoFile {
          url
          cropUrl(width: 1346, height: 546)
        }
      }
    }
  }
}

Actual result

{
  "data": {
    "homepage": {
      "headerImage": {
        "url": "https://media.umbraco.io/project-alias/hzejlmff/harley-davidson-1hzcjjdtc9g-unsplash.jpg&width=1346&height=546&upscale=false",
        "umbracoFile": {
          "url": "https://media.umbraco.io//media/hzejlmff/harley-davidson-1hzcjjdtc9g-unsplash.jpg",
          "cropUrl": "https://media.umbraco.io/project-alias/hzejlmff/harley-davidson-1hzcjjdtc9g-unsplash.jpg?center=0.37002867722248473,0.80833333333333335&mode=crop&width=1346&height=546&upscale=false"
        }
      }
    }
  }
}

As you can see the url on the mediapicker is invalid because the querystring does not start with a ? as also mentioned in this issue . That can be fixed by adding a extra parameter when calling the url on the media picker property : url(width: 1346, height: 546, cropMode:CROP). But the generated url does not contain the focal point coordinates

When calling the url directly on the media item selected it does not contain the project alias so it produces a invalid link.

Using cropUrl on the media item directly i get the desired url with focal point coordinates

Expected result

Calling url with parameters to generate a cropped image on the media picker should produce the exact same url as cropUrl on the media item.

umbrabot commented 2 years ago

Hiya @dawoe,

Just wanted to let you know that we noticed that this issue got a bit stale and might not be relevant any more.

We will close this issue for now but we're happy to open it up again if you think it's still relevant (for example: it's a feature request that's not yet implemented, or it's a bug that's not yet been fixed).

To open it this issue up again, you can write @umbrabot still relevant in a new comment as the first line. It would be super helpful for us if on the next line you could let us know why you think it's still relevant.

For example:

@umbrabot still relevant This bug can still be reproduced in version x.y.z

This will reopen the issue in the next few hours.

Thanks, from your friendly Umbraco GitHub bot :robot: :slightly_smiling_face: