media picker that restricts to image and svg files in v8?
hey out there,
in the past the main way i've saved the 'i want to pick an image or an svg' media picker is to use the multinode tree picker, something a little like this:
sure you lost the image thumbnail but it got the job done ;)
so i thought i'd use the same idea in v8 however the 'allow items of type' option of the multinode tree picker is no longer a text box!
worse still, even though i've selected a node type of 'media' i can only select doctype based types - media types aren't available...
i can't use a regular media picker with the 'disable folder select' option checked as it doesn't restrict the file type...
short of building my own property editor, is there a different solution out there to this?!
the bad news is it's blocked so i'm not 100% sure when it'll get merged in.
meanwhile though i've been doing some more digging and found the solution is to add this to the <content> section of the umbracoSettings.config file:
<imaging>
<!-- what file extension that should cause Umbraco to create thumbnails -->
<imageFileTypes>jpeg,jpg,gif,bmp,png,tiff,tif,svg</imageFileTypes>
<!-- what attributes that are allowed in the editor on an img tag -->
<!--<allowedAttributes>alt,border,class,style,align,id,name,onclick,usemap</allowedAttributes>-->
<!-- automatically updates dimension, file size and extension attributes on upload -->
<!--
<autoFillImageProperties>
<uploadField alias="umbracoFile">
<widthFieldAlias>umbracoWidth</widthFieldAlias>
<heightFieldAlias>umbracoHeight</heightFieldAlias>
<lengthFieldAlias>umbracoBytes</lengthFieldAlias>
<extensionFieldAlias>umbracoExtension</extensionFieldAlias>
</uploadField>
</autoFillImageProperties>
-->
</imaging>
i added svg to the list of imageFileTypes and hey presto i can now select svg files from a data type based on 'media picker' with 'pick only images' and 'disable folder select' checked.
happy days! it was good to go down the rabbit hole with regards to the multinode tree picker too, fingers crossed that bug will get resolved soon.
media picker that restricts to image and svg files in v8?
hey out there,
in the past the main way i've saved the 'i want to pick an image or an svg' media picker is to use the multinode tree picker, something a little like this:
sure you lost the image thumbnail but it got the job done ;)
so i thought i'd use the same idea in v8 however the 'allow items of type' option of the multinode tree picker is no longer a text box!
worse still, even though i've selected a node type of 'media' i can only select doctype based types - media types aren't available...
i can't use a regular media picker with the 'disable folder select' option checked as it doesn't restrict the file type...
short of building my own property editor, is there a different solution out there to this?!
cheers,
jake
I could be wrong, but aren't SVGs just treated as normal image files now when you upload them to media?
No I'm wrong - if you choose Pick only images then SVGs are disallowed.
yeah... that's what i was hoping would be the case!
there must be something in the core though that sets what umbraco considers to be a image?
gonna have a dig in the source...
ok, so i did some digging in the source code and found this:
then i found this:
https://our.umbraco.com/documentation/Reference/Config/umbracoSettings/
the above seems to indicate you could do something like this in the content section of the
umbracoSettings.config
:so i gave it a go and umbraco blows up!
feels like i'm heading in the right direction though...
interestingly, we're using a custom build of v8 at the moment so i might just try and change the line:
in the
src\Umbraco.Core\Configuration\UmbracoSettings\ContentImagingElement.cs
file adding svg to the list and seeing if it works!so, after reporting the bug with regards to the multinode treepicker it appears that it's already been reported:
https://github.com/umbraco/Umbraco-CMS/issues/5983
i was searching for 'multinode treepicker' rather than 'mntp' otherwise i guess i would've found it!
the good news is it's pr stage:
https://github.com/umbraco/Umbraco-CMS/pull/6177
the bad news is it's blocked so i'm not 100% sure when it'll get merged in.
meanwhile though i've been doing some more digging and found the solution is to add this to the
<content>
section of theumbracoSettings.config
file:i added
svg
to the list ofimageFileTypes
and hey presto i can now select svg files from a data type based on 'media picker' with 'pick only images' and 'disable folder select' checked.happy days! it was good to go down the rabbit hole with regards to the multinode tree picker too, fingers crossed that bug will get resolved soon.
is working on a reply...