Webiant Logo Webiant Logo
  1. No results found.

    Try your search with a different keyword or use * as a wildcard.

Extensions.cs

using Nop.Core.Domain.Media;
using Nop.Core.Infrastructure;

namespace Nop.Services.Media;

/// 
/// Extensions
/// 
public static partial class Extensions
{
    /// 
    /// Get absolute path for local images
    /// 
    /// Nop file provider
    /// Media settings
    /// 
    /// Get local images path
    public static string GetLocalImagesPath(this INopFileProvider fileProvider, MediaSettings mediaSettings, string path = null)
    {
        if (string.IsNullOrEmpty(path))
        {
            var imagePath = mediaSettings.PicturePath;

            path = string.IsNullOrEmpty(imagePath) ? NopMediaDefaults.DefaultImagesPath : imagePath;
        }

        if (!fileProvider.IsPathRooted(path))
            path = fileProvider.GetAbsolutePath(path);

        return path;
    }
}