Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi, I'm trying out v. 8 for a bit this morning. I'm having trouble rendering cropped image urls though. I did this the other day in v.7 without issues. Has anything changed or am I missing something?
testimonial.Image is a MediaPicker and I've defined a crop called "Testimonial".
@testimonial.Image.Url renders an URL fine.
@testimonial.Image.GetCropUrl("Testimonial") renders nothing.
@Url.GetCropUrl(testimonial.Image, "Testimonial") renders nothing.
If I go and edit the crop. The image renders afterwards. It seems you dont get a default crop?
I don't see this behaviour in v. 7.
I'm using umbraco 8. How is the idea of how to solve this problem?
Probably there are better ways to do this but this is how i did it:
@if (Image != null)
<img class="img-fluid d-block" src="@Image.GetCropUrl(250,150)" alt="@Image.Name" />
thanks for the answer, it solved
I don't think this solves the question since the extension with crop alias is not working in Umbraco 8.
Thank you @Josip! That was exactly the right solution, and after seeing it, it made my error make sense.
var featuredImage = model.Value<IPublishedContent>("featuredImage").GetCropUrl(276,276)
fails because I was trying to get the image and the URL at the same time. Your example makes total sense. Get the image, then ask for it's cropUrl. :-)
var featuredImage = model.Value<IPublishedContent>("featuredImage");
<img src="@featuredImage.GetCropUrl(276,276)" class="initial-img" />
I appreciate you! Thanks
It works but i don't think this is an optimal way.
Suppose we have used a particular resolution in various pages and whenever we need to change the resolution we have to check and change everywhere that is used manually.!
Where in Umbraco 7 we only need to change the resolution in the cropper simply
It looks like a bug in V8. I've added a github issue for this. https://github.com/umbraco/Umbraco-CMS/issues/5737
I was also facing the same problem. However when I reset the focus point in each of the images it started showing.
This code works:
I can confirm that GetCropUrl with alias only works after changing the focal point for the images.
Very strange behavior :)
I agree with Christian. It works after focal point change.
Yeah I agree. I have tested this loads and like a few mentioned above the crop doesn't work unless you go into the media section click on the image and edit the crop on the image.
It didn't work like this with Umbraco 7. It seems to be a bug that has been introduced into Umbraco 8.
I think I logged a bug for this a while ago.
It's a really frustrating but. I have become reliant on the cropper with all my projects. It worked amazingly in Umbraco 7. It's sort of become unusable at the member but I might trying and follow the recommendation above and manually set this.
I was also thinking I could write an extension method to heck of there is no crop set then use a fallback setting if not. That way we might be able to get best of both worlds making this hack more useful.
I will see how it goes.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted