How can I display images with projection layouts in Orchard 1.7?

冷暖自知 提交于 2019-12-20 03:52:50

问题


I use query layouts with properties and had been using .Url.Absolute in versions previous to 1.7 to get the path to an image.

Is there way to produce the image url and other properties from the new media library in a layout?

Thanks!


回答1:


Go to the Bindings tab under Queries. Under Orchard.MediaLibrary.Models.MediaPartRecord you'll see MediaPath and FileName, that together should get you where you need to be: those properties will then be available for you to add from the layout editor. Ideally, you could bind the MediaUrl property, but I think it being read-only is what prevents it from showing in the possible bindings. That may be worth filing abug, because it would be a lot more convenient a solution.




回答2:


for using {Content.Fields.MyPicture.Url.Absolute} you must Enable

Url Alternates

from modules features first.




回答3:


There is a Url token for MediaLibraryPickerField which is chainable with Url tokens.

Example: {Content.Fields.MyPicture.Url.Absolute}



来源:https://stackoverflow.com/questions/17888031/how-can-i-display-images-with-projection-layouts-in-orchard-1-7

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!