Search code examples
imageprocessor

How to ignore folders in ImageProcessor


Using the execlent library ImageProcessor is really easy. Thanks James

How do you prevent ImageProcessorModule from intercepting images from certain folder?

Say I have a folder named "DontResizeMe" - how make ImageProcessor ignore this folder?


Solution

  • I think there are a few ways to achieve this, depending on which part you want to avoid.

    You could inherit the ImageProcessingModule, and make your own pre-checks to determine if the request should be processed by the base class.

    You could use the OnValidatingRequest event, and cancel any requests in the folder you choose.

    There is a config setting for InterceptAllRequests that will ignore any request without query string params.

    You could make your own "noop" service, and configure that for the prefixes you want. See examples here: https://github.com/JimBobSquarePants/ImageProcessor/blob/2f2044da7bf7f3960928a7ea47f5540975946062/tests/ImageProcessor.TestWebsite/config/imageprocessor/security.config