Just started out with 7.x and Razor and am trying to figure out the logic... sigh!
I'm trying to set up a simpel image slider using image cropper/media picker.
Using Partial Views and Query builder for the first time, this is what i got:
@{
var selection = Umbraco.TypedContent(1146).Children("slidebillede").Where(x => x.IsVisible()).OrderBy("CreateDate desc");
}
<ul>
@foreach(var item in selection){
<li>
@{
if (item.HasValue("picFrontslide")){
var nodeId = item.Id;
var mediaItem = item.GetPropertyValue("picFrontslide");
if (mediaItem != null)
{
<img src="@nodeId" />
<img src="@mediaItem" />
<img src="@Umbraco.Content(nodeId).GetCropUrl("picFrontslide", "frontslide")" />
}
}
}
</li>
}
</ul>
So... I get the page id, the id of the selected media (value of "picFrontslide") and the selected media including what I assume is crop data?!...
Since this is not a solution I looked at what Leopold wrote in a former post regarding the image has to be parsed from the media archive before adding crop.
var mediaGet = Umbraco.TypedMedia(Model.Content.GetPropertyValue<int>("picFrontslide"));
if (mediaGet != null)
{
<img src="@Url.GetCropUrl(mediaGet, "frontslide")" />
}
This results in nothing...
Been searching through the forum and now I'm just more confused.
Can anyone help me out here and maybe explain how this works now?
Image Cropper - going from 6.2.6 to 7.6.4
Had to recreate this thread...
Just started out with 7.x and Razor and am trying to figure out the logic... sigh! I'm trying to set up a simpel image slider using image cropper/media picker. Using Partial Views and Query builder for the first time, this is what i got:
This renders out
So... I get the page id, the id of the selected media (value of "picFrontslide") and the selected media including what I assume is crop data?!... Since this is not a solution I looked at what Leopold wrote in a former post regarding the image has to be parsed from the media archive before adding crop.
This results in nothing...
Been searching through the forum and now I'm just more confused. Can anyone help me out here and maybe explain how this works now?
Cheers
I have not installed Umbraco Core Property Value Converters...
Is this necessary?
Bent, it's part of the core, please check - umbracoSetting.config setting: in section settings/content, setting EnablePropertyValueConverters.
It is set to "true" :)
so you can get image like:
I get nothing here...
Bent
Model.Content - is current page
no sense to use it in the loop
each time this code:
Does the same, get "picFrontslide" from the current page.
Maybe it should be like this:
Thanks,
Alex
Bingo!...
You wouldn't happen to have a link to some documentation, so I might get to understand what is going on here?
"Umbraco Core Property Value Converters" package is part of the core now, you can find more info about this here - https://github.com/Jeavon/Umbraco-Core-Property-Value-Converters/
is working on a reply...