I’m using the ImageResizer module in an ASP.NET MVC 4 project, along with the plugins SqlReader and MvcRoutingShim.
When I try to access the URL ~/databaseimages/123.jpg (for example), I just get the standard error 404 - The resource cannot be found.
My expectation was that ImageResizer would handle that request and try to read the image from the database, but it doesn’t even try to connect (I used SQL Profiler to verify this).
What can be wrong?
This is the output of /resizer.debug:
Image resizer diagnostic sheet 26-06-2012 20:42:57
1 Issues detected:
(Warning): To potentially see additional errors here, perform an image resize request.
You are using paid bundles: Cloud Bundle, Performance Bundle
Registered plugins:
ImageResizer.Plugins.Basic.DefaultEncoder
ImageResizer.Plugins.Basic.NoCache
ImageResizer.Plugins.Basic.ClientCache
ImageResizer.Plugins.Basic.Diagnostic
ImageResizer.Plugins.Basic.SizeLimiting
ImageResizer.Plugins.MvcRoutingShim.MvcRoutingShimPlugin
ImageResizer.Plugins.SqlReader.SqlReaderPlugin
ImageResizer.Plugins.DiskCache.DiskCache
Configuration:
<resizer>
<plugins>
<add name="MvcRoutingShim" />
<add name="SqlReader" prefix="~/databaseimages/" connectionString="database" idType="UniqueIdentifier" blobQuery="SELECT Content FROM Images WHERE ImageID=@id" modifiedQuery="Select ModifiedDate, CreatedDate From Images WHERE ImageID=@id" existsQuery="Select COUNT(ImageID) From Images WHERE ImageID=@id" requireImageExtension="false" cacheUnmodifiedFiles="true" extensionPartOfId="false" vpp="true" untrustedData="false" />
<add name="DiskCache" />
</plugins>
</resizer>
(…)
In your Web.config file, you declared that image IDs are all GUIDs:
idType="UniqueIdentifier", yet used a integer in the url:localhost:50272/databaseimages/123.jpg.If you’re not specifying a GUID in the URL, the request will be ignored. Change idType to a different data type, like Int, or use the correct data type in the URL.
Source: http://imageresizing.net/plugins/sqlreader