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
can someone help how to show image that is added from mediapicker in a template file without using xslt and razor..
am using umbraco v 4.8.1..
am having same issue as shown in this page
http://our.umbraco.org/forum/templating/templates-and-document-types/10542-Displaying-images-in-Template-from-Media-Picker
am getting image tag with no source like <img src="" />
this is the solution, its very simple..
<img src='<umbraco:Item field="modellbild" runat="server" Xslt="umbraco.library:GetMedia({0},false())/umbracoFile"></umbraco:Item>' alt=''/>
Hi Siva
That solution works. Many thanks.
Is there a razor way of doing it? (I dont know any xslt, and I am more comfortable using razor)
Thanks
OK Here is the way to do it in razor, using inline razor code.
Where "contentMediaImage" is the name of your Media Picker field.
<umbraco:Macro runat="server" Language="cshtml"> @inherits umbraco.MacroEngines.DynamicNodeContext@{if (Model.contentMediaImage != ""){ var media = Library.MediaById(Model.contentMediaImage);<img src="@media.umbracoFile" />}}</umbraco:Macro>
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Media Picker Image in template file without using xslt or razor
can someone help how to show image that is added from mediapicker in a template file without using xslt and razor..
am using umbraco v 4.8.1..
am having same issue as shown in this page
http://our.umbraco.org/forum/templating/templates-and-document-types/10542-Displaying-images-in-Template-from-Media-Picker
am getting image tag with no source like <img src="" />
this is the solution, its very simple..
<img src='<umbraco:Item field="modellbild" runat="server" Xslt="umbraco.library:GetMedia({0},false())/umbracoFile"></umbraco:Item>' alt=''/>
Hi Siva
That solution works. Many thanks.
Is there a razor way of doing it? (I dont know any xslt, and I am more comfortable using razor)
Thanks
OK Here is the way to do it in razor, using inline razor code.
Where "contentMediaImage" is the name of your Media Picker field.
<umbraco:Macro runat="server" Language="cshtml">
@inherits umbraco.MacroEngines.DynamicNodeContext
@{
if (Model.contentMediaImage != "")
{
var media = Library.MediaById(Model.contentMediaImage);
<img src="@media.umbracoFile" />
}
}
</umbraco:Macro>
is working on a reply...