Keith Butler
Keith Butler

Reputation: 31

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

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!

Upvotes: 1

Views: 3041

Answers (3)

alaki
alaki

Reputation: 7

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

Url Alternates

from modules features first.

Upvotes: 1

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

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

Upvotes: 0

Bertrand Le Roy
Bertrand Le Roy

Reputation: 17814

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.

Upvotes: 1

Related Questions