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
Hi evryone,
I have been instaled umbraco on www.uhurucloud.com, and now i don't know how to get url of image from media section to disoplay on my template.
Can explain how to get url by image name?
Thanks.
For XSLT: http://our.umbraco.org/wiki/reference/umbracolibrary/getmedia
For Razor (macro): http://umbraco.com/follow-us/blog-archive/2011/2/24/umbraco-47-razor-feature-walkthrough-%E2%80%93-part-2.aspx
For Razor (MVC): http://our.umbraco.org/Documentation/Reference/Mvc/querying
Jeroen
Hi Jeroen,
I use :
<umbraco:Macro runat="server" language="cshtml"> <img src='@item.Media("image_name").umbracoFile' alt=""/></umbraco:Macro>
but i get erro:
Error loading MacroEngine script (file: )
If you're using 4.11 or higher you could have a look at this: http://24days.in/umbraco/2012/introducing-the-umbraco-image-control/
Is umbraco v 4.7.2
In that case I don't think you should use @item in your example. I think it's @Model that you need.
I create a macro with imgID param and it work perfectly.
@{ var media = new umbraco.cms.businesslogic.media.Media( Convert.ToInt32(@Parameter.imgID) ); string imageUrl = media.getProperty("umbracoFile").Value.ToString(); <img src="@imageUrl" alt="" /> }
Thanks
The media object is very slow and uses a lot of calls to the database. It not recommended to use in the frontend of the website.
It might be good to have a look at the DAMP Gallery: http://24days.in/umbraco/2012/damp-gallery/
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
How to get url of Image ?
Hi evryone,
I have been instaled umbraco on www.uhurucloud.com, and now i don't know how to get url of image from media section to disoplay on my template.
Can explain how to get url by image name?
Thanks.
For XSLT: http://our.umbraco.org/wiki/reference/umbracolibrary/getmedia
For Razor (macro): http://umbraco.com/follow-us/blog-archive/2011/2/24/umbraco-47-razor-feature-walkthrough-%E2%80%93-part-2.aspx
For Razor (MVC): http://our.umbraco.org/Documentation/Reference/Mvc/querying
Jeroen
Hi Jeroen,
I use :
<umbraco:Macro runat="server" language="cshtml">
<img src='@item.Media("image_name").umbracoFile' alt=""/>
</umbraco:Macro>
but i get erro:
Error loading MacroEngine script (file: )
If you're using 4.11 or higher you could have a look at this: http://24days.in/umbraco/2012/introducing-the-umbraco-image-control/
Jeroen
Is umbraco v 4.7.2
In that case I don't think you should use @item in your example. I think it's @Model that you need.
Jeroen
I create a macro with imgID param and it work perfectly.
@{
var media = new umbraco.cms.businesslogic.media.Media( Convert.ToInt32(@Parameter.imgID) );
string imageUrl = media.getProperty("umbracoFile").Value.ToString();
<img src="@imageUrl" alt="" />
}
Thanks
The media object is very slow and uses a lot of calls to the database. It not recommended to use in the frontend of the website.
Jeroen
It might be good to have a look at the DAMP Gallery: http://24days.in/umbraco/2012/damp-gallery/
Jeroen
is working on a reply...