ImageResizer
3.4.0
|
Public Member Functions | |
PipelineConfig (Config c) | |
bool | IsAcceptedImageType (string path) |
The specified path must not include a querystring. Slashes, spaces, question marks, ampersands, and colons are not permitted in the extension. If it contains a multipart extension like .txt.zip, only "zip" will be recognized. Must contain a dot - passing in "jpg" will fail. More... | |
bool | HasPipelineDirective (System.Collections.Specialized.NameValueCollection q) |
Returns true if any of the querystring keys match any of the directives supported by the pipeline (such as width, height, format, bgcolor, etc) More... | |
string | TrimFakeExtensions (string path) |
Removes the first fake extensionm detected at the end of 'path' More... | |
IVirtualFile | GetFile (string virtualPath, NameValueCollection queryString) |
Returns either an IVirtualFile instance or a VirtualFile instance. More... | |
bool | FileExists (string virtualPath, NameValueCollection queryString) |
Returns true if (a) A registered IVirtualImageProvider says it exists, or (b) if the VirtualPathProvider chain says it exists. More... | |
ImageBuilder | GetImageBuilder () |
Returns an ImageBuilder instance to use for image processing. More... | |
ICacheProvider | GetCacheProvider () |
Returns a ICacheProvider instance that provides caching system selection and creation. More... | |
void | FirePostAuthorizeRequest (System.Web.IHttpModule sender, System.Web.HttpContext httpContext) |
void | FireRewritingEvents (System.Web.IHttpModule sender, System.Web.HttpContext context, IUrlEventArgs e) |
void | FireAuthorizeImage (System.Web.IHttpModule sender, System.Web.HttpContext context, IUrlAuthorizationEventArgs e) |
void | FireImageMissing (System.Web.IHttpModule sender, System.Web.HttpContext context, IUrlEventArgs e) |
void | FirePreHandleImage (System.Web.IHttpModule sender, System.Web.HttpContext context, IResponseArgs e) |
ICache | GetCachingSystem (System.Web.HttpContext context, IResponseArgs args) |
Cache selection occurs as follows: (1) The first registered CachingSystem that returns true from .CanProcess() is the default (2) The SelectCachingSystem event is fired, allowing handlers to modify the selected cache. This method may return null. More... | |
ResizeSettings | Modify (ResizeSettings settings) |
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... | |
Public Member Functions inherited from ImageResizer.Configuration.IPipelineConfig | |
bool | HasPipelineDirective (NameValueCollection q) |
True if the querystring contains any directives that are understood by the pipeline More... | |
void | FirePostAuthorizeRequest (IHttpModule sender, System.Web.HttpContext httpContext) |
void | FireRewritingEvents (IHttpModule sender, System.Web.HttpContext context, IUrlEventArgs ue) |
void | FireAuthorizeImage (IHttpModule sender, System.Web.HttpContext context, IUrlAuthorizationEventArgs urlEventArgs) |
void | FirePreHandleImage (IHttpModule sender, System.Web.HttpContext context, IResponseArgs e) |
void | FireImageMissing (IHttpModule sender, System.Web.HttpContext context, IUrlEventArgs urlEventArgs) |
Protected Member Functions | |
void | urlModifyingPlugins_Changed (SafeList< IQuerystringPlugin > sender) |
void | _cacheUrlData () |
Populates the cache if it is empty. Not thread safe. More... | |
Dictionary< string, bool > | getCachedDirectives () |
Dictionary< string, bool > | getCachedExtensions () |
string | getExtension (string path) |
Protected Attributes | |
Config | c |
object | _cachedUrlDataSync = new object() |
volatile Dictionary< string, bool > | _cachedDirectives = null |
volatile Dictionary< string, bool > | _cachedExtensions = null |
volatile IList< string > | _fakeExtensions = null |
volatile bool | firedFirstRequest = false |
volatile bool | firstRequestFinished = false |
object | firedFirstRequestSync = new object() |
long | processedCount = 0 |
Properties | |
ICollection< string > | AcceptedImageExtensions [get] |
Returns a unqiue copy of the image extensions supported by the pipeline. Performs a cached query to all registered IQuerystringPlugin instances. Use IsAcceptedImageType for better performance. More... | |
ICollection< string > | SupportedQuerystringKeys [get] |
Returns a unqiue copy of all querystring keys supported by the pipeline. Performs a cached query to all registered IQuerystringPlugin instances. Use HasPipelineDirective for better performance. (binary search) More... | |
IList< string > | FakeExtensions [get] |
Cached access to pipeline.fakeExtensions More... | |
string | ModifiedPathKey [get] |
string | StopRoutingKey [get] |
string | PreRewritePath [get, set] |
Returns the value of Context.Items["resizer.newPath"] if present. If not, returns FilePath + PathInfo. Sets Context.Items["resizer.newPath"]. Only useful during the Pipeline.PostAuthorizeRequestStart event. More... | |
string | ModifiedQueryStringKey [get] |
NameValueCollection | ModifiedQueryString [get, set] |
Returns the modified query string. If never set, returns a copy of Request.QueryString. Returns the same instance if called multiple times. Copy it if you want to make changes without causing issues. More... | |
string | SkipFileTypeCheckKey [get] |
bool | SkipFileTypeCheck [get, set] |
Get or sets whether the file extension check should be applied to the current request. Defaults to true. If set to true, will only affect the current request, and will only cause the Resizer to evaluate the rewriting rules on the request. Processing may still not occur if no querystring values are specified. Add 'cache=always' to force caching to occur. More... | |
string | ResponseArgsKey [get] |
bool | IsHandlingRequest [get] |
Returns true if the current request is being processed and/or cached by the pipeline. Will return false until after the FileExists method is called on the VirtualPathProviders, which is after the AuthorizeImage event fires. This will return a usable value if used from VirtualFile.Open(), or if used inside the PreHandleImage event or later. More... | |
VppUsageOption | VppUsage [get] |
long | ProcessedCount [get] |
The number of images processed by this pipeline. More... | |
bool | ModuleInstalled [get, set] |
True once the InterceptModule has been installed and is intercepting requests. More... | |
Properties inherited from ImageResizer.Configuration.IPipelineConfig | |
string | ModifiedQueryStringKey [get] |
The key in Context.Items to store the modified querystring (i.e, post-rewrite). Allows VirtualPathProviders to access the rewritten data. More... | |
string | ResponseArgsKey [get] |
The key in Context.Items to store the IResponseArgs object More... | |
string | StopRoutingKey [get] |
The key in Context.Items to set if we want to cancel MVC routing for the request More... | |
string | ModifiedPathKey [get] |
The key in Context.Items to access a the path to use instead of Request.path More... | |
VppUsageOption | VppUsage [get] |
The behavior to use when accessing the file system. More... | |
string | SkipFileTypeCheckKey [get] |
bool | SkipFileTypeCheck [get] |
Get or sets whether the file extension check should be applied to the current request. Defaults to true. If set to true, will only affect the current request, and will only cause the Resizer to evaluate the rewriting rules on the request. Processing may still not occur if no querystring values are specified. Add 'cache=always' to force caching to occur. More... | |
bool | ModuleInstalled [get, set] |
True once the InterceptModule has been installed. More... | |
string | PreRewritePath [get] |
Returns the value of Context.Items["resizer.newPath"] if present. If not, returns FilePath + PathInfo. Sets Context.Items["resizer.newPath"]. Only useful during the Pipeline.PostAuthorizeRequestStart event. More... | |
NameValueCollection | ModifiedQueryString [get, set] |
Events | |
RequestEventHandler | OnFirstRequest |
Fired once, on the first PostAuthorizeRequest event. More... | |
RequestEventHandler | PostAuthorizeRequestStart |
Fires during the PostAuthorizeRequest phase, prior to any module-specific logic. Executes for every request to the website. Use only as a last resort. Other events occur only for image requests, and thus have lower overhead. More... | |
UrlRewritingEventHandler | Rewrite |
Fired during PostAuthorizeRequest, after ResizeExtension has been removed. On fired on requests with extensions that match supported image types. More... | |
UrlRewritingEventHandler | RewriteDefaults |
Fired during PostAuthorizeRequest, after Rewrite. Any changes made here (which conflict) will be overwritten by the the current querystring values. I.e, this is a good place to specify default settings. More... | |
UrlRewritingEventHandler | PostRewrite |
Fired after all other rewrite events. More... | |
UrlAuthorizationEventHandler | AuthorizeImage |
Fired after all rewriting is finished. e.AllowAccess defaults to the result of the UrlAuthorization module's verdict. It can be changed. Set e.AllowAccess to true to cause and 403 Access Dened result. More... | |
UrlEventHandler | ImageMissing |
Fired when the specified image doesn't exist. Only called for images that would normally be processed. May be called during PostAuthorizeRequest or later - End the request completely with a redirect if you want alternate behavior. More... | |
PreHandleImageEventHandler | PreHandleImage |
Fired immediately before the image request is sent off to the caching system for proccessing. Allows modification of response headers, caching arguments, and callbacks. More... | |
CacheSelectionHandler | SelectCachingSystem |
Definition at line 19 of file PipelineConfig.cs.
|
inlineprotected |
Populates the cache if it is empty. Not thread safe.
Definition at line 47 of file PipelineConfig.cs.
|
inline |
Returns true if (a) A registered IVirtualImageProvider says it exists, or (b) if the VirtualPathProvider chain says it exists.
virtualPath | |
queryString |
Implements ImageResizer.Configuration.IPipelineConfig.
Definition at line 298 of file PipelineConfig.cs.
|
inline |
Returns a ICacheProvider instance that provides caching system selection and creation.
Implements ImageResizer.Configuration.IPipelineConfig.
Definition at line 310 of file PipelineConfig.cs.
|
inline |
Cache selection occurs as follows: (1) The first registered CachingSystem that returns true from .CanProcess() is the default (2) The SelectCachingSystem event is fired, allowing handlers to modify the selected cache. This method may return null.
context | |
args |
Implements ImageResizer.Caching.ICacheProvider.
Definition at line 444 of file PipelineConfig.cs.
|
inline |
Returns either an IVirtualFile instance or a VirtualFile instance.
virtualPath | |
queryString |
Implements ImageResizer.Configuration.IPipelineConfig.
Definition at line 270 of file PipelineConfig.cs.
|
inline |
Returns an ImageBuilder instance to use for image processing.
Implements ImageResizer.Configuration.IPipelineConfig.
Definition at line 306 of file PipelineConfig.cs.
|
inline |
Returns true if any of the querystring keys match any of the directives supported by the pipeline (such as width, height, format, bgcolor, etc)
q |
Definition at line 141 of file PipelineConfig.cs.
|
inline |
The specified path must not include a querystring. Slashes, spaces, question marks, ampersands, and colons are not permitted in the extension. If it contains a multipart extension like .txt.zip, only "zip" will be recognized. Must contain a dot - passing in "jpg" will fail.
path |
Implements ImageResizer.Configuration.IPipelineConfig.
Definition at line 131 of file PipelineConfig.cs.
|
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).
settings |
Implements ImageResizer.Plugins.ISettingsModifier.
Definition at line 463 of file PipelineConfig.cs.
|
inline |
Removes the first fake extensionm detected at the end of 'path'
path |
Implements ImageResizer.Configuration.IPipelineConfig.
Definition at line 174 of file PipelineConfig.cs.
|
get |
Returns a unqiue copy of the image extensions supported by the pipeline. Performs a cached query to all registered IQuerystringPlugin instances. Use IsAcceptedImageType for better performance.
Definition at line 103 of file PipelineConfig.cs.
|
get |
Cached access to pipeline.fakeExtensions
Definition at line 157 of file PipelineConfig.cs.
|
get |
Returns true if the current request is being processed and/or cached by the pipeline. Will return false until after the FileExists method is called on the VirtualPathProviders, which is after the AuthorizeImage event fires. This will return a usable value if used from VirtualFile.Open(), or if used inside the PreHandleImage event or later.
Definition at line 253 of file PipelineConfig.cs.
|
getset |
Returns the modified query string. If never set, returns a copy of Request.QueryString. Returns the same instance if called multiple times. Copy it if you want to make changes without causing issues.
Definition at line 217 of file PipelineConfig.cs.
|
getset |
True once the InterceptModule has been installed and is intercepting requests.
Definition at line 474 of file PipelineConfig.cs.
|
getset |
Returns the value of Context.Items["resizer.newPath"] if present. If not, returns FilePath + PathInfo. Sets Context.Items["resizer.newPath"]. Only useful during the Pipeline.PostAuthorizeRequestStart event.
Definition at line 196 of file PipelineConfig.cs.
|
get |
The number of images processed by this pipeline.
Definition at line 425 of file PipelineConfig.cs.
|
getset |
Get or sets whether the file extension check should be applied to the current request. Defaults to true. If set to true, will only affect the current request, and will only cause the Resizer to evaluate the rewriting rules on the request. Processing may still not occur if no querystring values are specified. Add 'cache=always' to force caching to occur.
Definition at line 237 of file PipelineConfig.cs.
|
get |
Returns a unqiue copy of all querystring keys supported by the pipeline. Performs a cached query to all registered IQuerystringPlugin instances. Use HasPipelineDirective for better performance. (binary search)
Definition at line 112 of file PipelineConfig.cs.
UrlAuthorizationEventHandler ImageResizer.Configuration.PipelineConfig.AuthorizeImage |
Fired after all rewriting is finished. e.AllowAccess defaults to the result of the UrlAuthorization module's verdict. It can be changed. Set e.AllowAccess to true to cause and 403 Access Dened result.
Definition at line 348 of file PipelineConfig.cs.
UrlEventHandler ImageResizer.Configuration.PipelineConfig.ImageMissing |
Fired when the specified image doesn't exist. Only called for images that would normally be processed. May be called during PostAuthorizeRequest or later - End the request completely with a redirect if you want alternate behavior.
Definition at line 355 of file PipelineConfig.cs.
RequestEventHandler ImageResizer.Configuration.PipelineConfig.OnFirstRequest |
Fired once, on the first PostAuthorizeRequest event.
Definition at line 317 of file PipelineConfig.cs.
RequestEventHandler ImageResizer.Configuration.PipelineConfig.PostAuthorizeRequestStart |
Fires during the PostAuthorizeRequest phase, prior to any module-specific logic. Executes for every request to the website. Use only as a last resort. Other events occur only for image requests, and thus have lower overhead.
Definition at line 322 of file PipelineConfig.cs.
UrlRewritingEventHandler ImageResizer.Configuration.PipelineConfig.PostRewrite |
Fired after all other rewrite events.
Only fired on accepted image types. (see Rewrite)
Definition at line 342 of file PipelineConfig.cs.
PreHandleImageEventHandler ImageResizer.Configuration.PipelineConfig.PreHandleImage |
Fired immediately before the image request is sent off to the caching system for proccessing. Allows modification of response headers, caching arguments, and callbacks.
Definition at line 361 of file PipelineConfig.cs.
UrlRewritingEventHandler ImageResizer.Configuration.PipelineConfig.Rewrite |
Fired during PostAuthorizeRequest, after ResizeExtension has been removed. On fired on requests with extensions that match supported image types.
You can add additonal supported image extentions by registering a plugin that implementes IQuerystringPlugin, or you can add an extra extension in the URL and remove it here. Example: .psd.jpg
Definition at line 331 of file PipelineConfig.cs.
UrlRewritingEventHandler ImageResizer.Configuration.PipelineConfig.RewriteDefaults |
Fired during PostAuthorizeRequest, after Rewrite. Any changes made here (which conflict) will be overwritten by the the current querystring values. I.e, this is a good place to specify default settings.
Only fired on accepted image types. (see Rewrite)
Definition at line 337 of file PipelineConfig.cs.