-
Notifications
You must be signed in to change notification settings - Fork 824
Media Picker 3 documentation #3106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
6b886d9
Media Picker 3 documentation
nielslyngsoe ffe151f
Display on the index page
nielslyngsoe fa346cd
corrected version
nielslyngsoe 7756e30
Adding part about Global Crops
nielslyngsoe de55389
Update Getting-Started/Backoffice/Property-Editors/Built-in-Property-…
nielslyngsoe 9771dcb
Update Getting-Started/Backoffice/Property-Editors/Built-in-Property-…
nielslyngsoe 0f414b6
Update Getting-Started/Backoffice/Property-Editors/Built-in-Property-…
nielslyngsoe e668f0a
Update Getting-Started/Backoffice/Property-Editors/Built-in-Property-…
nielslyngsoe 57f25cf
Update Getting-Started/Backoffice/Property-Editors/Built-in-Property-…
nielslyngsoe 266c366
Update Getting-Started/Backoffice/Property-Editors/Built-in-Property-…
nielslyngsoe 1c8123a
Update Getting-Started/Backoffice/Property-Editors/Built-in-Property-…
nielslyngsoe 346c0d7
Update Getting-Started/Backoffice/Property-Editors/Built-in-Property-…
nielslyngsoe 6c2f48e
Image croppings description
nielslyngsoe f495240
Merge branch 'v813/media-picker-3' of https://github.com/umbraco/Umbr…
nielslyngsoe c81a6be
Update Getting-Started/Backoffice/Property-Editors/Built-in-Property-…
nielslyngsoe 4b9c22c
Update Getting-Started/Backoffice/Property-Editors/Built-in-Property-…
nielslyngsoe 9c15052
Update Getting-Started/Backoffice/Property-Editors/Built-in-Property-…
nielslyngsoe 2f7b8f7
Update Getting-Started/Backoffice/Property-Editors/Built-in-Property-…
nielslyngsoe b7c63ca
Update index.md
sofietoft 1fdc3b1
Update index.md
sofietoft f49e033
Update index.md
nielslyngsoe 51cbac7
Update Getting-Started/Backoffice/Property-Editors/Built-in-Property-…
nielslyngsoe 186d47b
Update Getting-Started/Backoffice/Property-Editors/Built-in-Property-…
nielslyngsoe 6484ea8
mention Media Picker 3 in Image Cropper
nielslyngsoe c517063
added notice about media picker 3 in media picker *old*
nielslyngsoe 0c2b7aa
Merge branch 'main' into v813/media-picker-3
sofietoft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+138 KB
...itors/Built-in-Property-Editors/Media-Picker-3/images/Media-Picker3-Content.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+155 KB
...tors/Built-in-Property-Editors/Media-Picker-3/images/Media-Picker3-DataType.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
165 changes: 165 additions & 0 deletions
165
...d/Backoffice/Property-Editors/Built-in-Property-Editors/Media-Picker-3/index.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,165 @@ | ||
| --- | ||
| versionFrom: 8.14.0 | ||
| --- | ||
|
|
||
| # Media Picker # | ||
|
|
||
| `Alias: Umbraco.MediaPicker3` | ||
|
|
||
| `Returns: IEnumerable<MediaWithCrops>` or `MediaWithCrops` | ||
|
|
||
| This property editors returns a single `MediaWithCrops` item if the "Pick multiple items" data type setting is disabled or a collection if it is enabled. | ||
|
|
||
| ## Data Type Definition Example | ||
|
|
||
|  | ||
|
|
||
| ### Accepted types | ||
|
|
||
| Use setting to limit the picker to only select Media Items of these types. | ||
|
|
||
| ### Pick multiple items | ||
|
|
||
| Use this setting to enable the property to contain multiple items. When this is enabled the property editor returns an `IEnumerable<MediaWithCrops>`. | ||
|
|
||
| You can still set the maximum amount to 1. Do so when you want to retrieve a collection but only allow the Content Editors to select one Media Item. | ||
|
|
||
| ### Amount | ||
|
|
||
| Use this setting to enforce a minimum and/or maximum amount of selected Media Items. Note that it is not possible to set a maximum when the "Pick multiple items" feature is disabled. | ||
|
|
||
| ### Start node | ||
|
|
||
| This setting is used to limit the Media Picker to certain parts of the Media Tree. | ||
|
|
||
| ### Ignorer user start nodes | ||
|
|
||
| Use this setting to overrule user permissions, to enable any user of this property to pick any Media Item of the chosen Start node. | ||
|
|
||
| When this setting is enabled, a user who doesn't normally have access to the media selected as "Start Node" (/Design in this case), can access the media when using this particular Media Picker. If no Start node has been defined for this property any content can be viewed and selected of this property. | ||
|
|
||
|
|
||
| ### Enable Focal Point | ||
|
|
||
| Enable the focal point setter, do only enable this if the focal point is used or if you have Image crops defined. | ||
|
|
||
| ### Image Crops | ||
|
|
||
| Define local image crops. Local image crop data is stored on the document in this property. This means it can differentiate between documents. | ||
|
|
||
| This is different from Global crops as they are defined on the Media Item, making the crops shared between all usage of that Media Item. | ||
|
|
||
| Global crops are configured on the Image Cropper property of the Image Media Type | ||
|
|
||
| [Read about the Image Cropper here](../Image-Cropper/index.md) | ||
|
|
||
| ## Content Example | ||
|
|
||
|  | ||
|
|
||
| ## MVC View Example | ||
|
|
||
| ### Multiple enabled without Modelsbuilder | ||
|
|
||
| ```csharp | ||
| @{ | ||
| var typedMultiMediaPicker = Model.Value<IEnumerable<MediaWithCrops>>("medias"); | ||
| foreach (var entry in typedMultiMediaPicker) | ||
| { | ||
| <img src="@entry.MediaItem.Url" style="width:200px"/> | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### Multiple enabled with Modelsbuilder | ||
|
|
||
| ```csharp | ||
| @{ | ||
| var typedMultiMediaPicker = Model.Medias; | ||
| foreach (var entry in typedMultiMediaPicker) | ||
| { | ||
| <img src="@entry.MediaItem.Url" style="width:200px" /> | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### Multiple disabled without Modelsbuilder | ||
|
|
||
| ```csharp | ||
| @{ | ||
| var typedMediaPickerSingle = Model.Value<MediaWithCrops>("media"); | ||
| if (typedMediaPickerSingle != null) | ||
| { | ||
| <img src="@typedMediaPickerSingle.MediaItem.Url" style="width:200px" alt="@typedMediaPickerSingle.MediaItem.Value("alt")" /> | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### Multiple disabled with Modelsbuilder | ||
|
|
||
| ```csharp | ||
| @{ | ||
| var typedMediaPickerSingle = Model.Media; | ||
| if (typedMediaPickerSingle is MediaWithCrops mediaEntry) | ||
| { | ||
| <img src="@mediaEntry.MediaItem.Url" style="width:200px"/> | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ## Using local crops | ||
|
|
||
| Local image crops are stored and retrieved differently than global crops. Below are two examples of how to retrieve local crops. | ||
|
|
||
| ### Using GetLocalCropUrl | ||
|
|
||
| ```csharp | ||
| @{ | ||
| foreach (var entry in Model.Medias) | ||
| { | ||
| <img src="@entry.GetLocalCropUrl("cropAlias")"/> | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### Using UrlHelper | ||
|
|
||
| ```csharp | ||
| @{ | ||
| foreach (var entry in Model.Medias) | ||
| { | ||
| <img src="@Url.GetCropUrl(entry.LocalCrops, "cropAlias")"/> | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ## Use global crops | ||
|
|
||
| Global image croppings are crops stored on the Media Item, by the Property Editor `Image Cropper`, making it shared between all usages of the media Item. | ||
|
|
||
| The global crops are configured on the DataType of the `umbracoFile` property on the Media Type `Image` | ||
|
|
||
| [Read about the Image Cropper here](../Image-Cropper/index.md) | ||
|
|
||
| ### Using GetCropUrl | ||
|
|
||
| ```csharp | ||
| @{ | ||
| foreach (var entry in Model.Medias) | ||
| { | ||
| <img src="@entry.MediaItem.GetCropUrl("cropAlias")"/> | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### Using UrlHelper | ||
|
|
||
| ```csharp | ||
| @{ | ||
| foreach (var entry in Model.Medias) | ||
| { | ||
| <img src="@Url.GetCropUrl(entry.MediaItem, "cropAlias")"/> | ||
| } | ||
| } | ||
|
|
||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.