Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Rene Becker 5 posts 76 karma points
    Apr 18, 2019 @ 10:53
    Rene Becker
    0

    FileSystemProviders Section umbraco 8 to change media location

    Hi, Where is the FileSystemProvidersSection in umbraco 8? I wanna change the media location.

  • Dave de Moel 116 posts 542 karma points c-trib
    Apr 18, 2019 @ 11:44
    Dave de Moel
    101

    In Umbraco 8 you do this using a composer to create a custom physical file system instance.

    public class MediaComposer : IUserComposer
    {
        public void Compose(Composition composition)
        {
            composition.SetMediaFileSystem(() => new PhysicalFileSystem("~/CustomMedia"));
        }
    }
    

    More about composing you can read here: https://our.umbraco.com/documentation/Implementation/Composing/

  • Hugo Becerra 10 posts 80 karma points
    Aug 16, 2019 @ 10:05
    Hugo Becerra
    0

    Hi Dave,

    Is possible to use a network location as media folder with this method?

    Thanks!

  • Dave de Moel 116 posts 542 karma points c-trib
    Aug 16, 2019 @ 11:38
    Dave de Moel
    2

    You'll need to create a custom FileSystemProvider for that, which you can then set using above method:

    public class MediaComposer : IUserComposer
    {
        public void Compose(Composition composition)
        {
            composition.SetMediaFileSystem(() => new MyCustomFileSystem());
        }
    }
    

    Though if your network location is the Azure Blob storage you can use the following: https://our.umbraco.com/documentation/Extending/FileSystemProviders/Azure-Blob-Storage/

  • Hugo Becerra 10 posts 80 karma points
    Aug 16, 2019 @ 13:25
    Hugo Becerra
    0

    Ok, then I have to create a totally new class to handle images because the existing one doesn´t support network locations? Wow, a lot of work.

    Thanks for your help!

  • Alex Skrypnyk 5363 posts 19800 karma points MVP 3x admin c-trib
    Sep 05, 2019 @ 00:20
    Alex Skrypnyk
    0

    Hi Dave,

    Do you know what to do with already uploaded images into /media folder?

    Thanks,

    Alex

  • Dave de Moel 116 posts 542 karma points c-trib
    Sep 05, 2019 @ 07:48
    Dave de Moel
    1

    I have never ran into a situation where reuploading wasn't an option, But I guess if that isn't an option, just uploading the folders in the media section to the remote storage should work if you use the virtual path provider, as the internal relative url's in Umbraco don't change then.

  • Alex Skrypnyk 5363 posts 19800 karma points MVP 3x admin c-trib
    Sep 20, 2019 @ 21:24
    Alex Skrypnyk
    0

    Hi

    Thanks for your input on how to change the root media folder. It works for me. But I still have a problem with image thumbnails that were uploaded to the custom media folder.

    enter image description here

    Thumbnails are broken in Umbraco 8.1.3.

    Exception says:

    File '/media/gepjronu/poster.jpg' is outside this filesystem's root.
    

    Image calling - /umbraco/backoffice/UmbracoApi/Images/GetBigThumbnail?originalImagePath=%2Fmedia%2Fgepjronu%2Fposter.jpg&rnd=0.5137560516892847

    what is wrong I suppose.

    Thanks,

    Alex

Please Sign in or register to post replies

Write your reply to:

Draft