Umbraco,在子节点中显示来自媒体选择器的图像

Umbraco,在子节点中显示来自媒体选择器的图像,umbraco,Umbraco,我有一个产品视图,其中应该显示一些产品。ProductItem是Products的子节点,其属性为productImage,它是媒体选择器。我有两个ProductItem,并在媒体选择器中分别分配了一个图像,但在站点上呈现它们时遇到问题 @inherits Umbraco.Web.Mvc.UmbracoViewPage<ContentModels.Products> @using ContentModels = Umbraco.Web.PublishedModels; @{

我有一个产品视图,其中应该显示一些产品。ProductItem是Products的子节点,其属性为productImage,它是媒体选择器。我有两个ProductItem,并在媒体选择器中分别分配了一个图像,但在站点上呈现它们时遇到问题

@inherits Umbraco.Web.Mvc.UmbracoViewPage<ContentModels.Products>
@using ContentModels = Umbraco.Web.PublishedModels;
@{
    Layout = "Master.cshtml";

    var products = Umbraco.Content(Guid.Parse("2740e0b9-caf3-435a-89c5-982ed890e6bd"))
        .ChildrenOfType("ProductItem")
        .Where(x => x.IsVisible())
        .OrderByDescending(x => x.CreateDate);


}

@foreach (var product in products)
{
  <section class="page-section">
    <div class="container">
      <div class="product-item">
        <div class="product-item-title d-flex">
          <div class="bg-faded p-5 d-flex ml-auto rounded">
            <h2 class="section-heading mb-0">
              <span class="section-heading-upper">@product.Value("productSubtitle")</span>
              <span class="section-heading-lower">@product.Value("productTitle")</span>
            </h2>
          </div>
        </div>
        <img class="product-item-img mx-auto d-flex rounded img-fluid mb-3 mb-lg-0" src="" alt="">
        <div class="product-item-description d-flex mr-auto">
          <div class="bg-faded p-5 rounded">
            <p class="mb-0">@product.Value("productContent")</p>
          </div>
        </div>
      </div>
    </div>
  </section>
}
@继承Umbraco.Web.Mvc.UmbracoViewPage
@使用ContentModels=Umbraco.Web.PublishedModels;
@{
Layout=“Master.cshtml”;
var products=Umbraco.Content(Guid.Parse(“2740e0b9-caf3-435a-89c5-982ed890e6bd”))
.ChildrenOfType(“产品项”)
.Where(x=>x.IsVisible())
.OrderByDescending(x=>x.CreateDate);
}
@foreach(产品中的var产品)
{
@产品价值(“产品字幕”)
@产品价值(“产品名称”)

@product.Value(“产品内容”)

}
我可以毫无问题地显示其他信息。我已经阅读了几十篇论坛帖子和文档,但我似乎无法找到一个简单的解决方案,只在我的foreach循环中显示每个产品的图片。我正在使用最新版本的Umbraco

产品项目:

指定的图像:


看起来您忘记在视图中渲染它了。“src”属性为空-请参阅所附屏幕截图

请随时查看有关如何从媒体选择器渲染图像的Umbraco文档