I went back add added crop aliases to the media library; I can see them when I look at the media item, and they are responsive based on the focal point.
However, I have been unable to determine the magical incantation to fetch the crop with the focal point. It appears to use the ImageCropAnchor no matter what. The name of my crop setting is "masthead"
Here are some of the incantations that do not work (keep in mind there was experimentation going on, so the code is not optimal):
var tmp = mastHead.mastheadImage.First();
var mediaItem = Umbraco.TypedMedia(tmp.Id);
mastHeadImageUrl = Url.GetCropUrl(mediaItem, "masthead").ToString();
Perplexed by GetCropUrl in 7.6
I went back add added crop aliases to the media library; I can see them when I look at the media item, and they are responsive based on the focal point.
However, I have been unable to determine the magical incantation to fetch the crop with the focal point. It appears to use the ImageCropAnchor no matter what. The name of my crop setting is "masthead"
Here are some of the incantations that do not work (keep in mind there was experimentation going on, so the code is not optimal):
mastHeadImageUrl = mastHead.mastheadImage.First().GetCropUrl(cropAlias:"masthead"); mastHeadImageUrl = mastHead.mastheadImage.First().GetCropUrl(cropAlias: "masthead", preferFocalPoint: true); mastHeadImageUrl = mastHead.mastheadImage.First().GetCropUrl(propertyAlias: "umbracoFile", cropAlias: "masthead");
The image is selected using the media picker, and the actual image resides in the media library.
If I try to use the GetCropUrl on the document, (called masthead) like this:
I receive "1985?mode=pad&rnd=131394550750000000"
1985 is the MediaId of the image.
Can anyone point me in the right direction here?
Hi John :)
I'm not sure if you are trying to get the Cropped Url or something else? :) But if it's just the cropped url i would do this .. :)
Hi Anders,
I want the cropped Url, but I need it to use the focal point.
The incantations above all give a cropped url, but it is not paying attention to the focal point set in the media library.
Bug opened: http://issues.umbraco.org/issue/U4-9942
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion