I know this is a newbie question, but how can I show an image, added
with the upload picker in the content editor screen on the final page?
The umbraco:item tag just shows the URL text.
I've
tried creating an XSLT macro to do this, but I can't seem to figure out
how to pass a variable to the XSLT macro for the URL path. I know I can
specify fields in the Macro directly. Ideally I would prefer a Razor solution to an XSLT solution if possible.
Lets say you have a upload picker (Media Picker) property on your DocumentType with alias photo. You can get the image url in your page with the following razor syntax:
I'm guessing right now, but I think that the Image element (.photo in the example above) would hang off either Node.CurrentPage or Document.CurrentPage (or it may be Document.Current - not quite sure).
Probably better off creating your question as a new topic though so it's easier for people searching to find the right solution - You'll probably end up with a better answer too! :o)
How do I show an Image?
I know this is a newbie question, but how can I show an image, added with the upload picker in the content editor screen on the final page?
The umbraco:item tag just shows the URL text.
I've tried creating an XSLT macro to do this, but I can't seem to figure out how to pass a variable to the XSLT macro for the URL path. I know I can specify fields in the Macro directly. Ideally I would prefer a Razor solution to an XSLT solution if possible.
Hi,
Lets say you have a upload picker (Media Picker) property on your DocumentType with alias photo. You can get the image url in your page with the following razor syntax:
Cheers, Richard
That worked like a dream - Thanks Richard!
What should I do if I am trying to render an image through a .NET usercontrol?
I'm guessing right now, but I think that the Image element (.photo in the example above) would hang off either Node.CurrentPage or Document.CurrentPage (or it may be Document.Current - not quite sure).
Probably better off creating your question as a new topic though so it's easier for people searching to find the right solution - You'll probably end up with a better answer too! :o)
Thanks! I'd "High five!" you, but I don't have enough karma points yet. Lol
Or like this
Upload picker
<img src="@Model.photo" />
From media gallery
<img src="@Model.Media("photo", "umbracoFile")" alt="@Model.Name"/>
What properties are on Dynamic Media? I was looking to access the image width and height.. if it is an image! how would i check if it is an image?
Cheers
Tom
Thanks very much, this helped me a lot!
is working on a reply...