Example #1
0
 /// <summary>
 /// The base constructor.
 /// Sets up the Imgix url builder base options.
 /// </summary>
 /// <param name="options"></param>
 /// <exception cref="ArgumentNullException"><paramref name="options"/> is null</exception>
 /// <exception cref="ArgumentException"><paramref name="options"/> is empty</exception>
 public Imgix(IImgixOptions options)
 {
     if (options == null)
     {
         throw new ArgumentNullException(nameof(options));
     }
     if (!options.Sources.Any())
     {
         throw new ArgumentException(nameof(options) + " You must define at least one source", nameof(options));
     }
     _sources = options.Sources.ToDictionary(source => source.Name, source => source);
 }
Example #2
0
 /// <summary>
 /// Creates a new imgix image from a supplied options object
 /// </summary>
 /// <param name="options">The base options</param>
 /// <param name="path">The path to the image</param>
 /// <returns></returns>
 public static ImgixImage CreateImage(IImgixOptions options, string path)
 => new Imgix(options).NewImage(path);
Example #3
0
 /// <summary>
 /// Creates a new imgix image from a supplied options object
 /// </summary>
 /// <param name="options">The base options</param>
 /// <param name="path">The path to the image</param>
 /// <returns></returns>
 public static ImgixImage CreateImage(IImgixOptions options, string path)
     => new Imgix(options).NewImage(path);
Example #4
0
 /// <summary>
 /// The base constructor.
 /// Sets up the Imgix url builder base options.
 /// </summary>
 /// <param name="options"></param>
 /// <exception cref="ArgumentNullException"><paramref name="options"/> is null</exception>
 /// <exception cref="ArgumentException"><paramref name="options"/> is empty</exception>
 public Imgix(IImgixOptions options)
 {
     if (options == null) throw new ArgumentNullException(nameof(options));
     if (!options.Sources.Any()) throw new ArgumentException(nameof(options)+" You must define at least one source", nameof(options));
     _sources = options.Sources.ToDictionary(source => source.Name, source => source);
 }