Ticket (Solved)

Using media picker on front of site

I like how the media picker works in the admin section of orchard. What I need to do is allow authenticated users to upload a profile image, much like orchardpro's lets you do. It seems like I should be able to pass the part to the view and call something like @Display(Model.MediaPicker) or something close to that. Let me know what you think is a good way to accomplish this task.

Re: Using media picker on front of site

I recently refactored the MediaLibraryPickerField and extracted out its core functionality into a reusable shape that you could render anywhere. The shape is called MediaLibraryPicker, and you can render it like so:

    FieldName: Html.FieldNameFor(m => m.SelectedIds),
    DisplayName: Model.Field.DisplayName,
    Multiple: settings.Multiple,
    Required: settings.Required,
    Hint: settings.Hint,
    ContentItems: Model.ContentItems)

(Example taken from MediaLibraryPicker.Edit.cshtml) The ContentItems property can be set to the currently selected content items. It's up to you where you get those from, but definitely check out the MediaLibraryPickerFieldDriver to see how it's done there.

Friday, August 8, 2014 1:42:20 AM bysfmskywalker

Re: Using media picker on front of site

Perfect, thanks sipke!

Friday, August 8, 2014 6:49:07 AM byRob Allred

Post a reply

You need to be signed in to post a reply.

Sign In