예제 #1
0
    /// <summary>
    /// Returns a URL with custom resizing parameters for a media profile for an existing image path.
    /// </summary>
    public static async Task <string> ImageProfileResizeUrlAsync(this IOrchardHelper orchardHelper, string imagePath, string imageProfile, int?width = null, int?height = null, ResizeMode resizeMode = ResizeMode.Undefined, int?quality = null, Format format = Format.Undefined, Anchor anchor = null, string bgcolor = null)
    {
        var mediaProfileService = orchardHelper.HttpContext.RequestServices.GetRequiredService <IMediaProfileService>();
        var queryStringParams   = await mediaProfileService.GetMediaProfileCommands(imageProfile);

        var resizedUrl = ImageSharpUrlFormatter.GetImageResizeUrl(imagePath, queryStringParams, width, height, resizeMode, quality, format, anchor, bgcolor);

        return(orchardHelper.TokenizeUrl(resizedUrl));
    }
예제 #2
0
    /// <summary>
    /// Returns a URL with custom resizing parameters for an existing image path.
    /// </summary>
    public static string ImageResizeUrl(this IOrchardHelper orchardHelper, string imagePath, int?width = null, int?height = null, ResizeMode resizeMode = ResizeMode.Undefined, int?quality = null, Format format = Format.Undefined, Anchor anchor = null, string bgcolor = null)
    {
        var resizedUrl = ImageSharpUrlFormatter.GetImageResizeUrl(imagePath, null, width, height, resizeMode, quality, format, anchor, bgcolor);

        return(orchardHelper.TokenizeUrl(resizedUrl));
    }