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

Public Member Functions

IPlugin Install (Configuration.Config c)
 
bool Uninstall (Configuration.Config c)
 
- 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...
 

Protected Member Functions

string parseResizeFolderSyntax (string path, NameValueCollection q)
 Parses and removes the resize folder syntax "resize(x,y,f)/" from the specified file path. Places settings into the referenced querystring More...
 

Protected Attributes

Regex resizeFolder
 Matches /resize(x,y,f)/ syntax Fixed Bug - will replace both slashes.. make first a lookbehind More...
 

Detailed Description

Definition at line 9 of file FolderResizeSyntax.cs.

Member Function Documentation

string ImageResizer.Plugins.Basic.FolderResizeSyntax.parseResizeFolderSyntax ( string  path,
NameValueCollection  q 
)
inlineprotected

Parses and removes the resize folder syntax "resize(x,y,f)/" from the specified file path. Places settings into the referenced querystring

Parameters
path
qThe collection to place parsed values into
Returns

Definition at line 48 of file FolderResizeSyntax.cs.

48  {
49  Match m = resizeFolder.Match(path);
50  if (m.Success) {
51  //Parse capture groups
52  int maxwidth = -1; if (!int.TryParse(m.Groups["maxwidth"].Value, NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out maxwidth)) maxwidth = -1;
53  int maxheight = -1; if (!int.TryParse(m.Groups["maxheight"].Value, NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out maxheight)) maxheight = -1;
54  string format = (m.Groups["format"].Captures.Count > 0) ? format = m.Groups["format"].Captures[0].Value : null;
55 
56  //Remove first resize folder from URL
57  path = resizeFolder.Replace(path, "", 1);
58 
59  //Add values to querystring
60  if (maxwidth > 0) q["maxwidth"] = maxwidth.ToString(NumberFormatInfo.InvariantInfo);
61  if (maxheight > 0) q["maxheight"] = maxheight.ToString(NumberFormatInfo.InvariantInfo);
62  if (format != null) q["format"] = format;
63 
64  //Call recursive - this handles multiple /resize(w,h)/resize(w,h)/ occurrences
65  return parseResizeFolderSyntax(path, q);
66  }
67 
68  return path;
69  }
string parseResizeFolderSyntax(string path, NameValueCollection q)
Parses and removes the resize folder syntax "resize(x,y,f)/" from the specified file path...
Regex resizeFolder
Matches /resize(x,y,f)/ syntax Fixed Bug - will replace both slashes.. make first a lookbehind ...

Member Data Documentation

Regex ImageResizer.Plugins.Basic.FolderResizeSyntax.resizeFolder
protected
Initial value:
= new Regex(@"(?<=^|\/)resize\(\s*(?<maxwidth>\d+)\s*,\s*(?<maxheight>\d+)\s*(?:,\s*(?<format>jpg|png|gif)\s*)?\)\/", RegexOptions.Compiled
| RegexOptions.IgnoreCase)

Matches /resize(x,y,f)/ syntax Fixed Bug - will replace both slashes.. make first a lookbehind

Definition at line 37 of file FolderResizeSyntax.cs.


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