Skip to content
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

Media Picker - restrict on file type (.svg, .mp4 etc) #4921

Closed
madsrasmussen opened this issue Mar 8, 2019 · 9 comments
Closed

Media Picker - restrict on file type (.svg, .mp4 etc) #4921

madsrasmussen opened this issue Mar 8, 2019 · 9 comments

Comments

@madsrasmussen
Copy link
Contributor

madsrasmussen commented Mar 8, 2019

Sometimes you need to restrict a specific media picker to a particular type of file. It could be cases where you only want to allow SVG upload, video uploads, etc. A pre value field to specify which file types are allowed in the data type would be amazing.

I imagine the functionality could work very much like the "Allow items of type" in the Multinode tree picker.


This item has been added to our backlog AB#4622

@bjarnef
Copy link
Contributor

bjarnef commented Dec 16, 2019

Maybe the "Allow items of type" should all be based on the media type similar to how MNTP use this for content type (document type).

It should probably be considered how it should work with the existing options onlyImages and onlyFolders. Does it still need these options if this feature is added or could it be re-designed a bit?
https://github.com/umbraco/Umbraco-CMS/blob/v8/dev/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/mediapicker/mediapicker.controller.js#L32-L33

Would it be better to have a multi-picker to select the available media types instead of manual enter a comma delimited list of aliases? Maybe this multi-picker could also be used for document types and member types?

The other part of this would be to restrict to select media items where it attached media is of a specific type, e.g. .svg, .pdf, .mp4, .mp3, etc.

@nielslyngsoe nielslyngsoe added state/sprint-candidate We're trying to get this in a sprint at HQ in the next few weeks state/hq-discussion labels Jan 20, 2020
@hades200082
Copy link

I come across this requirement often when creating media pickers for video displays.

For example, I need a content type where the user must upload video files in multiple formats (mp4, webm & ogv) in order to create a HTML structure like this..

 <video autoplay="" muted="" loop="" playsinline="" id="vid" preload="auto" poster="http://i.onionstatic.com/onion/1506/8/original/1200.jpg">
        <source src="https://s3.amazonaws.com/micada.org/public/Newnew.mp4" type="video/mp4">
        <source src="https://s3.amazonaws.com/micada.org/public/Newnew.webm" type="video/webm">
        <source src="https://s3.amazonaws.com/micada.org/public/Newnew.ogv" type="video/ogv">
    </video>

MP4 I make mandetory and have to other two as optional, only rendering the associated source if they are uploaded.

This means I need 3 separate media pickers, one specifically for each type.

@umbrabot
Copy link

umbrabot commented Mar 5, 2021

Hiya @madsrasmussen,

Just wanted to let you know that we noticed that this issue got a bit stale and might not be relevant any more.

We will close this issue for now but we're happy to open it up again if you think it's still relevant (for example: it's a feature request that's not yet implemented, or it's a bug that's not yet been fixed).

To open it this issue up again, you can write @umbrabot still relevant in a new comment as the first line. It would be super helpful for us if on the next line you could let us know why you think it's still relevant.

For example:

@umbrabot still relevant
This bug can still be reproduced in version x.y.z

This will reopen the issue in the next few hours.

Thanks, from your friendly Umbraco GitHub bot 🤖 🙂

@umbrabot umbrabot added the status/stale Marked as stale due to inactivity label Mar 5, 2021
@umbrabot umbrabot closed this as completed Mar 5, 2021
@umbrabot umbrabot removed state/hq-discussion state/sprint-candidate We're trying to get this in a sprint at HQ in the next few weeks labels Mar 5, 2021
@FransdeJong
Copy link
Contributor

@umbrabot still relevant

Ran into this requirement today. It would be great if we could somehow set only a pdf or a mp4 or whatever.

@bjarnef
Copy link
Contributor

bjarnef commented Mar 11, 2021

@madsrasmussen @nielslyngsoe I wonder if this is considered for the new Media Picker v3? Maybe also restrict by media type similar to MNTP, which would make the "Pick only images" and "Disable folder select" obsolete. #8471

Furhermore "Minimum" and "Maximum" configuration properties would make it more consistent with Multi-URL Picker and MNTP and make it more flexible as the current configuration only allow a single or multiple - not e.g. restrict up to 5 or 10 items.

@umbrabot umbrabot reopened this Mar 11, 2021
@kfr-dwarf
Copy link

Had the same request from a client today, would be great to see this feature in a future version.
Minimum and maximum configuration properties would also be a great addition, as suggested by Bjarnef above.

@nul800sebastiaan
Copy link
Member

Good news then! The new media picker in the upcoming 8.14.0 does exactly this, can configure what media types are allowed per media picker restrict it with a min/max number of items as well.

image

And when you create an upload field on a media type you can restrict it to exactly the extensions you want!

image

So all of these feature requests are now covered and I'll close this one! 🙌

@Nikkelmann
Copy link
Contributor

@nul800sebastiaan
Having searched through the docs, issues, discussions and source code, I've decided against my better judgement to necro post on this issue - sorry - this is the most relevant spot I found.

Does the above mention implementation of MediaTypes enable limiting the Media Picker to specific file types, and if so, how?

In my specific use-case I want the user to only select images of type PNG.

@FransdeJong
Copy link
Contributor

@Nikkelmann
If you want answers for questions like these the best place would be the forum on our Umbraco.

That said, you can achieve this by creating a new Media type.
First add a new datatype with the property editor File Upload.
Call it something like PNG upload and add png to the accepted file extensions.

After that go to Media Type in settings and copy the image media type.
Rename the copy to something like PNG media picker
Replace the Image property to the newly created png upload property and save.

This should create a PNG only media picker.

If this doesn't work please open up a discussion on Our and I'll try to help you over there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants