ImageResizer  3.4.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
Public Member Functions | Static Public Member Functions | Protected Member Functions | Properties | List of all members
ImageResizer.Plugins.Basic.Presets Class Reference
Inheritance diagram for ImageResizer.Plugins.Basic.Presets:
Inheritance graph
[legend]
Collaboration diagram for ImageResizer.Plugins.Basic.Presets:
Collaboration graph
[legend]

Public Member Functions

 Presets (Dictionary< string, ResizeSettings > defaults, Dictionary< string, ResizeSettings > settings, bool onlyAllowPresets)
 
IPlugin Install (Configuration.Config c)
 
ResizeSettings Modify (ResizeSettings s)
 Implementations should support being called on their own result multiple times without behavioral differences. Currently only executed in the managed API, too late to affect the disk cache, but that will probably change (it's likely all ISettingsModifiers will get executed twice, once after PostRewrite and once before the managed API executes). More...
 
bool Uninstall (Configuration.Config c)
 
IEnumerable< string > GetSupportedQuerystringKeys ()
 If the plugin reads any values from the querystring, the names of the keys should be specified here. This information is required so that the HttpModule knows when to handle an image request. More...
 
IEnumerable< IIssueGetIssues ()
 
- Public Member Functions inherited from ImageResizer.Plugins.IPlugin
IPlugin Install (Config c)
 Installs the plugin in the specified Config instance. The plugin must handle all the work of loading settings, registering the plugin etc. More...
 
bool Uninstall (Config c)
 Uninstalls the plugin. Should reverse all changes made during Install More...
 

Static Public Member Functions

static NameValueCollection FilterQuerystring (NameValueCollection s, bool keepHmacAndUrl64)
 Returns an new NameValueCollection instance that only includes the "preset" and ("hmac" and "urlb64", if specified) querystring pairs from the specified instance. More...
 

Protected Member Functions

void ParseXml (Node n, Config conf)
 

Properties

bool OnlyAllowPresets [get, set]
 If true, the plugin will block all commands except those specified in a preset, and the &preset command itself. Only applies to InterceptModule (the URL API). Does not apply to ImageBuilder.Build calls. To replicate the behavior, simply prevent any querystring keys except 'preset' from being passed to ImageBuilder.Build. More...
 

Detailed Description

Definition at line 11 of file Presets.cs.

Member Function Documentation

static NameValueCollection ImageResizer.Plugins.Basic.Presets.FilterQuerystring ( NameValueCollection  s,
bool  keepHmacAndUrl64 
)
inlinestatic

Returns an new NameValueCollection instance that only includes the "preset" and ("hmac" and "urlb64", if specified) querystring pairs from the specified instance.

Parameters
s
keepHmacAndUrl64
Returns

Definition at line 59 of file Presets.cs.

59  {
60  NameValueCollection q = new NameValueCollection();
61  string preset = s["preset"];
62  string hmac = s["hmac"];
63  string urlb64 = s["urlb64"];
64  if (preset != null) q["preset"] = preset.ToLowerInvariant();
65  if (keepHmacAndUrl64 && hmac != null) q["hmac"] = hmac;
66  if (keepHmacAndUrl64&& urlb64 != null) q["urlb64"] = urlb64;
67  return q;
68  }
IEnumerable<string> ImageResizer.Plugins.Basic.Presets.GetSupportedQuerystringKeys ( )
inline

If the plugin reads any values from the querystring, the names of the keys should be specified here. This information is required so that the HttpModule knows when to handle an image request.

Returns

Implements ImageResizer.Plugins.IQuerystringPlugin.

Definition at line 151 of file Presets.cs.

151  {
152  return new string[] { "preset" };
153  }
ResizeSettings ImageResizer.Plugins.Basic.Presets.Modify ( ResizeSettings  settings)
inline

Implementations should support being called on their own result multiple times without behavioral differences. Currently only executed in the managed API, too late to affect the disk cache, but that will probably change (it's likely all ISettingsModifiers will get executed twice, once after PostRewrite and once before the managed API executes).

Parameters
settings
Returns

Implements ImageResizer.Plugins.ISettingsModifier.

Definition at line 83 of file Presets.cs.

83  {
84  if (!string.IsNullOrEmpty(s["preset"])) {
85  string[] presets = s["preset"].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
86  foreach (string p in presets) {
87  //Apply defaults
88  if (defaults.ContainsKey(p)) {
89  ResizeSettings dq = defaults[p];
90  foreach (string key in dq.Keys) {
91  if (s[key] == null) s[key] = dq[key]; //Overwrite null and missing values on defaults.
92  }
93  }
94  //Apply overrides
95  if (settings.ContainsKey(p)) {
96  ResizeSettings sq = settings[p];
97  foreach (string key in sq.Keys) {
98  s[key] = sq[key]; //Overwrite null and missing values on defaults.
99  }
100  }
101  }
102  s.Remove("preset");
103  }
104  return s;
105  }

Property Documentation

bool ImageResizer.Plugins.Basic.Presets.OnlyAllowPresets
getset

If true, the plugin will block all commands except those specified in a preset, and the &preset command itself. Only applies to InterceptModule (the URL API). Does not apply to ImageBuilder.Build calls. To replicate the behavior, simply prevent any querystring keys except 'preset' from being passed to ImageBuilder.Build.

Definition at line 124 of file Presets.cs.


The documentation for this class was generated from the following file: