Copied to clipboard

Flag this post as spam?

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


  • ssougnez 93 posts 319 karma points c-trib
    Nov 21, 2021 @ 19:38
    ssougnez
    0

    Media on network share: Can upload but not see

    Hello,

    I configured my media path like this:

    public void Compose(Composition composition)
    {
        var mediaPath = ConfigurationManager.AppSettings[Helpers.Constants.AppSettings.MediaPath].ToString();
        var environment = ConfigurationManager.AppSettings[Helpers.Constants.AppSettings.Environment].ToString();
    
        if (environment == Helpers.Constants.Environments.Local)
        {
            mediaPath = Path.Combine(mediaPath, Environment.MachineName);
        }
    
        composition.SetMediaFileSystem(() => new PhysicalFileSystem(mediaPath, "/files"));
    }
    

    This allows me to use media from a network share. The issue is that it works when I want to upload a new media, the item is created and the file is uploaded but when I click on a media in the library to see its details, the picture does not appear.

    It also does not appear on the right pane displaying the thumbnail of images but I figured out that it was because ImageProcessor does not use the path set in the code above, so I had to create a custom ImageService.

    Now, I see the thumbnails in the right pane, but clicking on the images does not show them. Moreover, if I access the image directly (like "http://localhost/file/myfile.jpg"), it does not work either.

    What more do I have to configure to be able to see the image?

  • ssougnez 93 posts 319 karma points c-trib
    Nov 21, 2021 @ 20:07
    ssougnez
    100

    Ok, found the solution...

    I also needed to create a virtual directory on my development machine to resolve the images.

    Just in case someone needs the solution, just locate the applicationhost.config file of your solution (in the .vs) folder and add a virtualDirectory entry like this:

    <virtualDirectory path="/files" physicalPath="\\network\path" />
    
Please Sign in or register to post replies

Write your reply to:

Draft