VintaSoft Imaging .NET SDK and Plug-ins Discussions

Questions, comments and suggestions concerning VintaSoft Imaging .NET SDK.

Board index < VintaSoft Imaging < VintaSoft Imaging .NET SDK and Plug-ins Discussions

We are migrating to new forums engine, no new registration or posting currently available. TIA for your patience.

Change default path for upload and cache storage



Change default path for upload and cache storage

Post by Johnsnow »

Hi,

I had created sample project by following this tutorial.
https://www.vintasoft.com/docs/vsimagin ... ation.html

Its working fine, but Its currently upload the files in the folder "wwwroot/UploadedImageFiles", and creating all cache data in the folder "wwwroot/VintasoftCache", I want to change these paths.

Please advise. And also can you advise to clear cache data programmatically after save/burn annotations.

Thanks,


Re: Change default path for upload and cache storage

Post by Alex »

Hi John,
Its working fine, but Its currently upload the files in the folder "wwwroot/UploadedImageFiles", and creating all cache data in the folder "wwwroot/VintasoftCache", I want to change these paths. If you want to change name of upload directory from "UploadedImageFiles" to other name in ASP.NET Core project, you need to do the following steps:
  • Create custom API controller that is derived from VintaSoft API controller. For example, create MyVintasoftImageApiController class derived from Vintasoft.Imaging.AspNetCore.ApiControllers.VintasoftImageApiController class. Remember, you need to create custom API controller for each used web service, i.e. VintasoftImageApiController, VintasoftImageCollectionApiController, etc.
  • In created class override the CreateSessionDataStorage method. Here is example:
    protected override IDataStorage CreateSessionDataStorage(string sessionId)
    {
        if (sessionId == null)
        {
            if (IsEmptySessionSupported)
                sessionId = "";
            else
                throw new ArgumentNullException("sessionId");
        }
    
        string path = Path.Combine(HostingEnvironment.WebRootPath, "UploadedImageFiles", sessionId);
        if (!Directory.Exists(path))
            Directory.CreateDirectory(path);
    
        return new StreamDataStorageOnDisk(path);
    }
    

Please also read how to create custom data storage for image files here: https://www.vintasoft.com/docs/vsimagin ... abase.html


And also can you advise to clear cache data programmatically after save/burn annotations. You can get image cache manager of web image viewer using the WebImageViewerJS.get_ImageCacheManager function.

The WebImageCacheManagerJS class allows to manage cache of web images.

Best regards, Alexander


Page 1 from 1: 1