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
Im trying to show an image. simple.. but it defies me..
@page.logo
Gets me the image id (1231)
@Umbraco.Media(1231).Url
Gets me the image url
@Umbraco.Media(page.logo).Url or @Umbraco.Media(@page.logo).Url
Gives me an error... Why?
Can you try @page.logo.GetType() to see what it returns?
@page.logo.GetType()
Maybe
@Umbraco.Media(Convert.toInt32(page.logo)).Url
Or
@Umbraco.Media(Convert.toInt32(page.logo.ToString())).Url
If defined: System.int32
If undefined: Umbraco.Core.Dynamics.DynamicsNull
Of so you need a test then
if (page.HasValue("logo")){ @Umbraco.Media(page.logo).Url }
Of course, the check...
And i needed an @ in this context
@if (page.HasValue("logo")){ <img src="@Umbraco.Media(page.logo).Url" /> }
Thanks :)
Np, you can't pass in that DynamicNull which is why it was throwing, the check stops that.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Get an image... Should be simple..
Im trying to show an image. simple.. but it defies me..
Gets me the image id (1231)
Gets me the image url
Gives me an error... Why?
Can you try
@page.logo.GetType()
to see what it returns?Maybe
Or
If defined:
System.int32
If undefined:
Umbraco.Core.Dynamics.DynamicsNull
Of so you need a test then
Of course, the check...
And i needed an @ in this context
Thanks :)
Np, you can't pass in that DynamicNull which is why it was throwing, the check stops that.
is working on a reply...