SetParameter() public method

A quick way of adding parameters to the ImageUrlBuilder configuration
If the or are null or empty
public SetParameter ( string parameterName, string parameterValue ) : ImageUrlBuilder
parameterName string The parameter name
parameterValue string The parameter value
return ImageUrlBuilder
Exemplo n.º 1
0
        /// <summary>
        /// Allows you to define sets of settings in Web.config and reference them by name.
        /// </summary>
        /// <param name="presets">A list of preset settings groups to apply. <example>preset1,preset2,preset3</example></param>
        public static ImageUrlBuilder ApplyPresets(this ImageUrlBuilder builder, string presets)
        {
            if (string.IsNullOrEmpty(presets))
            {
                throw new ArgumentNullException("presets");
            }

            return(builder.SetParameter(MiscCommands.Preset, presets));
        }
Exemplo n.º 2
0
        /// <summary>
        /// The path to the fallback image, or a named preset if the image is not found.
        /// For more information see http://imageresizing.net/docs/reference
        /// </summary>
        public static ImageUrlBuilder Image404(this ImageUrlBuilder builder, string fallbackImagePathOrPresetName)
        {
            if (string.IsNullOrEmpty(fallbackImagePathOrPresetName))
            {
                throw new ArgumentNullException("fallbackImagePathOrPresetName");
            }

            return(builder.SetParameter(MiscCommands.Image404, fallbackImagePathOrPresetName));
        }
Exemplo n.º 3
0
        /// <summary>
        /// The name of one or more watermark layers (or layer groups) to render.
        /// For more information see http://imageresizing.net/plugins/watermark
        /// </summary>
        public static ImageUrlBuilder Watermark(this ImageUrlBuilder builder, string watermarkNames)
        {
            if (string.IsNullOrEmpty(watermarkNames))
            {
                throw new ArgumentNullException("watermarkNames");
            }

            return(builder.SetParameter(MiscCommands.Watermark, watermarkNames));
        }
Exemplo n.º 4
0
 /// <summary>
 /// The DPI at which the image should be printed. Ignored by all browsers, most operating systems, and most printers.
 /// </summary>
 public static ImageUrlBuilder DPI(this ImageUrlBuilder builder, DPIOptions dpiOption)
 {
     return(builder.SetParameter(MiscCommands.DPI, ((int)dpiOption).ToString()));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Always forces the image to be re-encoded even if it wasn't modified.
 /// No prevents the image from being modified.
 /// </summary>
 public static ImageUrlBuilder Process(this ImageUrlBuilder builder, ProcessOptions processOption = ProcessOptions.Default)
 {
     return(builder.SetParameter(MiscCommands.Process, processOption.ToString().ToLowerInvariant()));
 }
Exemplo n.º 6
0
 /// <summary>
 /// Always forces the image to be cached even if it wasn't modified by the resizing module.
 /// No disables caching even if it was.
 /// </summary>
 public static ImageUrlBuilder Cache(this ImageUrlBuilder builder, CacheOptions cacheOption = CacheOptions.Default)
 {
     return(builder.SetParameter(MiscCommands.Cache, cacheOption.ToString().ToLowerInvariant()));
 }
Exemplo n.º 7
0
 /// <summary>
 /// Ignores the ICC profile embedded in the source image
 /// </summary>
 public static ImageUrlBuilder IgnoreICC(this ImageUrlBuilder builder)
 {
     return(builder.SetParameter(MiscCommands.IgnoreICC, true.ToString().ToLowerInvariant()));
 }