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
I'm having problems getting the image url to the croppede image:
style="background-image: url(@Url.GetCropUrl(Model.Content, "billede", "ImageCrop.Thumb"))"
It returns:
style="background-image: url(1055?mode=pad&rnd=131302645130000000)"
What am I missing?
Umbraco 7.5.7
Hi Jon
Try to use strongly typed way, I think code should be like that:
@{ var mediaItem = Umbraco.TypedMedia(Model.Content); if (mediaItem != null) { <img src="@Url.GetCropUrl(mediaItem, "ImageCrop.Thumb")" /> } }
Thanks,
Alex
Hi Alex
Thank you for your answer! Unfortunately there where no luck.
My image field is call: billede My crop (ImageCrop) has 3 sizes: Hero, Teaser and Thumb.
If I call the image by id - theres no problem...
background-image: url(@Umbraco.Media(1055).GetCropUrl("hero"))
But I need it to be dynamic
I think you need something like this. Works for me....
<img style="background-image" src="@CurrentPage.GetCropUrl("PropertyAliasHere", "WhateverYouHaveCalledTheCropHere")" />
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
Get cropped image
I'm having problems getting the image url to the croppede image:
It returns:
What am I missing?
Umbraco 7.5.7
Hi Jon
Try to use strongly typed way, I think code should be like that:
Thanks,
Alex
Hi Alex
Thank you for your answer! Unfortunately there where no luck.
My image field is call: billede My crop (ImageCrop) has 3 sizes: Hero, Teaser and Thumb.
If I call the image by id - theres no problem...
But I need it to be dynamic
I think you need something like this. Works for me....
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.