ImageResizer
3.4.0
|
Holds settings used to create a SqlReader More...
Public Member Functions | |
SqlReaderSettings (System.Collections.Specialized.NameValueCollection args) | |
void | FireBeforeAccess (string id) |
Fires the BeforeAccess event More... | |
bool | IsStringType (SqlDbType t) |
Returns true if the specified type is a kind of strings More... | |
bool | IsIntType (SqlDbType t) |
Returns true if the specified type is a kind of integer More... | |
Properties | |
bool | StripFileExtension [get, set] |
When true, the last file extension segment will be removed from the URL before the SQL Id is parsed. Only relevant when ImageIdType is a string type. Always true for other values. Configured by setting 'extensionPartOfId' to the opposite value. More... | |
bool | RegisterAsVirtualPathProvider [get, set] |
(default: true) When true, the SqlReader will be registered as a VirtualPathProvider with ASP.NET, which will make this plugin's virtual files accessible from all code which depends on the VirtualPathProvider system. If trust levels don't allow that, it falls back to IVirtualImageProvider mode, which allows the image resizer to access the files, but not other systems, so you'll need to enable cacheUnmodifiedFiles if you want to access files without resizing them. More... | |
bool | RequireImageExtension [get, set] |
(default true) When false, all URLs inside the PathPrefix folder will be assumed to be images, and will be handled by this plugin. You should still use image extensions, otherwise we don't know what content type to send with the response, and browsers will choke. It's also the cleanest way to tell the image resizer what kind of file type you'd like back when you request resizing. This setting is designed to support non-image file serving from the DB. It will also cause conflicts if PathPrefix overlaps with a folder name used for something else. More... | |
bool | UntrustedData [get, set] |
(default: false) When true, all requests will be re-encoded before being served to the client. Invalid or malicious images will fail with an error if they cannot be read as images. This should prevent malicious files from being served to the client. More... | |
bool | CacheUnmodifiedFiles [get, set] |
(default false). When true, files and unmodified images (i.e, no querystring) will be cached to disk (if they are requested that way) instead of only caching requests for resized images. DiskCache plugin must be installed for this to have any effect. More... | |
bool | CheckForModifiedFiles [get, set] |
If true (default), SQL will be consulted on each image view to ensure the cached image is up to date and the original still exists. More... | |
string | PathPrefix [get, set] |
Defines a virtual path where database images can be accessed. Defaults to "~/databaseimages/" Ex image URL: localhost/databaseimages/4953.jpg More... | |
string | VirtualPathPrefix [get] |
Returns PathPrefix, but with the "~" resolved - I.e, a full virtual path. If the string doesn't start with / or ~, the application path is prepended as if it started with ~/ More... | |
string | ConnectionString [get, set] |
The database connection string. Defaults to null. You can specify an existing web.config connection string using the "ConnectionStrings:namedKey" convention. More... | |
bool | QueriesAreStoredProcedures [get, set] |
string | ImageBlobQuery [get, set] |
The query that returns the binary image data based on the ID. Defaults to "SELECT Content FROM Images WHERE ImageID=@id" More... | |
string | ModifiedDateQuery [get, set] |
The query that returns the modified and created date of the image. Defaults to "Select ModifiedDate, CreatedDate From Images WHERE ImageID=@id". Of all the dates returned by the query, the first non-empty date is used. More... | |
string | ImageExistsQuery [get, set] |
The query that returns whether an image exists or not. Defaults to "Select COUNT(ImageID) From Images WHERE ImageID=@id" More... | |
SqlDbType | ImageIdType [get, set] |
Specifies the type of ID used for images. Int, string, and GUID types are the only valid values. Throws an ArgumentOutOfRange exception if set to an invalid value. More... | |
Events | |
AuthorizeEvent | BeforeAccess |
Called before accessing any row in the database. The row ID is passed as a string argument. If the current user should not access the row, throw an HttpException(403, "message") More... | |
Holds settings used to create a SqlReader
Definition at line 16 of file SqlReaderSettings.cs.
|
inline |
Fires the BeforeAccess event
id |
Definition at line 48 of file SqlReaderSettings.cs.
|
inline |
Returns true if the specified type is a kind of integer
t |
Definition at line 199 of file SqlReaderSettings.cs.
|
inline |
Returns true if the specified type is a kind of strings
Definition at line 189 of file SqlReaderSettings.cs.
|
getset |
(default false). When true, files and unmodified images (i.e, no querystring) will be cached to disk (if they are requested that way) instead of only caching requests for resized images. DiskCache plugin must be installed for this to have any effect.
Definition at line 100 of file SqlReaderSettings.cs.
Referenced by ImageResizer.Plugins.SqlReader.SqlReaderPlugin.Install().
|
getset |
If true (default), SQL will be consulted on each image view to ensure the cached image is up to date and the original still exists.
Definition at line 108 of file SqlReaderSettings.cs.
|
getset |
The database connection string. Defaults to null. You can specify an existing web.config connection string using the "ConnectionStrings:namedKey" convention.
Definition at line 134 of file SqlReaderSettings.cs.
Referenced by ImageResizer.Plugins.SqlReader.SqlReaderPlugin.GetConnectionObj(), and ImageResizer.Plugins.SqlReader.SqlReaderPlugin.GetIssues().
|
getset |
The query that returns the binary image data based on the ID. Defaults to "SELECT Content FROM Images WHERE ImageID=@id"
Definition at line 146 of file SqlReaderSettings.cs.
Referenced by ImageResizer.Plugins.SqlReader.SqlReaderPlugin.GetStream().
|
getset |
The query that returns whether an image exists or not. Defaults to "Select COUNT(ImageID) From Images WHERE ImageID=@id"
Definition at line 166 of file SqlReaderSettings.cs.
Referenced by ImageResizer.Plugins.SqlReader.SqlReaderPlugin.RowExists().
|
getset |
Specifies the type of ID used for images. Int, string, and GUID types are the only valid values. Throws an ArgumentOutOfRange exception if set to an invalid value.
Definition at line 176 of file SqlReaderSettings.cs.
Referenced by ImageResizer.Plugins.SqlReader.SqlReaderPlugin.CreateIdParameter(), and ImageResizer.Plugins.SqlReader.SqlReaderPlugin.ParseIdFromVirtualPath().
|
getset |
The query that returns the modified and created date of the image. Defaults to "Select ModifiedDate, CreatedDate From Images WHERE ImageID=@id". Of all the dates returned by the query, the first non-empty date is used.
Definition at line 157 of file SqlReaderSettings.cs.
Referenced by ImageResizer.Plugins.SqlReader.SqlReaderPlugin.GetCacheDependencyQuery(), and ImageResizer.Plugins.SqlReader.SqlReaderPlugin.GetDateModifiedUtc().
|
getset |
Defines a virtual path where database images can be accessed. Defaults to "~/databaseimages/" Ex image URL: localhost/databaseimages/4953.jpg
Definition at line 116 of file SqlReaderSettings.cs.
|
getset |
(default: true) When true, the SqlReader will be registered as a VirtualPathProvider with ASP.NET, which will make this plugin's virtual files accessible from all code which depends on the VirtualPathProvider system. If trust levels don't allow that, it falls back to IVirtualImageProvider mode, which allows the image resizer to access the files, but not other systems, so you'll need to enable cacheUnmodifiedFiles if you want to access files without resizing them.
Definition at line 67 of file SqlReaderSettings.cs.
Referenced by ImageResizer.Plugins.SqlReader.SqlReaderPlugin.Install().
|
getset |
(default true) When false, all URLs inside the PathPrefix folder will be assumed to be images, and will be handled by this plugin. You should still use image extensions, otherwise we don't know what content type to send with the response, and browsers will choke. It's also the cleanest way to tell the image resizer what kind of file type you'd like back when you request resizing. This setting is designed to support non-image file serving from the DB. It will also cause conflicts if PathPrefix overlaps with a folder name used for something else.
Definition at line 80 of file SqlReaderSettings.cs.
Referenced by ImageResizer.Plugins.SqlReader.SqlReaderPlugin.Install().
|
getset |
When true, the last file extension segment will be removed from the URL before the SQL Id is parsed. Only relevant when ImageIdType is a string type. Always true for other values. Configured by setting 'extensionPartOfId' to the opposite value.
Definition at line 57 of file SqlReaderSettings.cs.
Referenced by ImageResizer.Plugins.SqlReader.SqlReaderPlugin.ParseIdFromVirtualPath().
|
getset |
(default: false) When true, all requests will be re-encoded before being served to the client. Invalid or malicious images will fail with an error if they cannot be read as images. This should prevent malicious files from being served to the client.
Definition at line 90 of file SqlReaderSettings.cs.
Referenced by ImageResizer.Plugins.SqlReader.SqlReaderPlugin.Install().
|
get |
Returns PathPrefix, but with the "~" resolved - I.e, a full virtual path. If the string doesn't start with / or ~, the application path is prepended as if it started with ~/
Definition at line 125 of file SqlReaderSettings.cs.
Referenced by ImageResizer.Plugins.SqlReader.SqlReaderPlugin.Install(), and ImageResizer.Plugins.SqlReader.SqlReaderPlugin.ParseIdFromVirtualPath().
AuthorizeEvent ImageResizer.Plugins.SqlReader.SqlReaderSettings.BeforeAccess |
Called before accessing any row in the database. The row ID is passed as a string argument. If the current user should not access the row, throw an HttpException(403, "message")
Definition at line 42 of file SqlReaderSettings.cs.