Maybea stupid question, but are you sure that the CurrentPage has an image assigned and the generel_image is not empty for the page that you are on. It just to be sure ;-)
@{ if(CurrentPage.HasValue("generel_image")){ var image = Umbraco.Media(CurrentPage.generel_image); <img src='@image.GetCropUrl("standard")'/> } }
Does it any different if you try the typed version? Something like this:
@{ if (CurrentPage.HasValue("generel_image")){ var image = Umbraco.TypedMedia((int)CurrentPage.generel_image); <a href="@CurrentPage.Url" class="image image-full"> <img src='@image.GetCropUrl("standard")' alt="" /> </a> } } }
No image output
In spite of following Jeavon's nice uHangout I can't get an Image output with Razor.
This is my code:
On the doument I have a Media picker and on the Media I swapped the Upload with the Cropper.
What am I doing wrong here ? I don't get any errors.
Hi Sebastian,
Maybe a stupid question, but are you sure that the CurrentPage has an image assigned and the generel_image is not empty for the page that you are on. It just to be sure ;-)
Does it any different if you try the typed version? Something like this:
Hope this helps,
/Dennis
Well, if I try to render generel_media with GetMedia in XSLT i get this:
And if I add @CurrentPage.HasValue("generel_image") it gives me False.
Hi Sebastian,
After changing from uplaod to image cropper, can you please try to edit and save the media item?
Also could you please try the below to see what result you get and post the result?
Jeavon
Is it a copy paste error that the value in xslt is
generel_media
and in razor it'sgenerel_image
?Spelled general btw ? :D
Hi Sebastian,
One thing that I have noticed is when you are trying to get the image in XSLT you´re using generel_media as propertyAlias
When you are do it In Razor you are using the generel_image as propertyAlias
Should it not be generel_media like this instead of generel_image
Hope this helps,
/Dennis
Thanx alot. That was the problem :)
is working on a reply...