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
I know it´s a noob question. I´m new to Umbraco but i have searshed the forum but with no luck.
I have this razor macro to write a piece of html.
int contador = 0; foreach(var item in Model.AncestorOrSelf(1).InicialPreLancamento) { contador++; var node = Library.NodeById(item.InnerText); <li> <a href="@node.Url">
<img src="@node.Logo" alt="" /> <img src="@node.ImagemGrande" alt="" /> <h3>@node.Nome</h3> @node.DescricaoResumida </a> </li> }
@node.Logo is an Upload data type and it works.
@node.ImagemGrande is only on e DAMP image and I cant figure out how to make it work.
Does anyone knows how to get this picture?
Hi,
Try @node.ImagemGrande[0].Image.umbracoFile
Image being the media type of the media item which I'm assuming is Image unless you created a custom one. The [0] is saying to get the first selected image since DAMP can have multiple images selected.
-Tom
It return an error:
Error loading Razor Script pre-lancamento.cshtml'char' does not contain a definition for 'Image'
In the properties of your DAMP datatype, are you storing the "Full Media XML" or "ID"?
Guessing by that error message you are just storing the ID, in which case I think you can use:
var myMedia = Library.MediaById(@node.ImagemGrande);<img src="@myMedia.umbracoFile" />
Weird cuz it´s Full Media XML but it worked throught MediaByID
Thank you very much. It solved the problem.
Odd, maybe it was changed and the document needs to be resaved to store the full XML?
It´s XML. I changed a picture, saved and it´s still showing the picture.
You can now use the DAMP Razor Model. It will always return the same objects so it doesn't matter if you store it as xml or id.
Jeroen
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
How to get the image from DAMP property?
I know it´s a noob question. I´m new to Umbraco but i have searshed the forum but with no luck.
I have this razor macro to write a piece of html.
int contador = 0;
foreach(var item in Model.AncestorOrSelf(1).InicialPreLancamento)
{
contador++;
var node = Library.NodeById(item.InnerText);
<li>
<a href="@node.Url">
<img src="@node.Logo" alt="" />
<img src="@node.ImagemGrande" alt="" />
<h3>@node.Nome</h3>
@node.DescricaoResumida
</a>
</li>
}
@node.Logo is an Upload data type and it works.
@node.ImagemGrande is only on e DAMP image and I cant figure out how to make it work.
Does anyone knows how to get this picture?
Hi,
Try @node.ImagemGrande[0].Image.umbracoFile
Image being the media type of the media item which I'm assuming is Image unless you created a custom one. The [0] is saying to get the first selected image since DAMP can have multiple images selected.
-Tom
It return an error:
Error loading Razor Script pre-lancamento.cshtml
'char' does not contain a definition for 'Image'
In the properties of your DAMP datatype, are you storing the "Full Media XML" or "ID"?
Guessing by that error message you are just storing the ID, in which case I think you can use:
-Tom
Weird cuz it´s Full Media XML but it worked throught MediaByID
Thank you very much. It solved the problem.
Odd, maybe it was changed and the document needs to be resaved to store the full XML?
It´s XML. I changed a picture, saved and it´s still showing the picture.
You can now use the DAMP Razor Model. It will always return the same objects so it doesn't matter if you store it as xml or id.
Jeroen
is working on a reply...