I'm using ImageResizer while the clients find images with this format: <http://website/imagehandler.aspx?id=120&width=240&height=300>
This is a different way of addressing images using folder hierarchy, as I use id to find the image location.

Formerly, I wrote a custom plugin for my case of usage but I had some thread-safety issues with that solution, as mentioned here: [imageresizer-shows-wrong-image](https://stackoverflow.com/questions/32242470/imageresizer-shows-wrong-image).
Nathanael (developer of image resizer) advised me not to use custom plugin and use the default ImageResizingModule.

How I can maintain my URL api (using id in query string) while leveraging ImageResizer?

**EDIT :**

This is how I have developed my own Plugin

```
public class MyImageResizerPlugin : IPlugin, IQuerystringPlugin, IVirtualImageProvider
{
    private IVirtualFile _imageVirtualFile;

    public IPlugin Install(Config c)
    {
        c.Plugins.add_plugin(this);
        return this;
    }

    public bool Uninstall(Config c)
    {
        c.Plugins.remove_plugin(this);
        return true;
    }

    public bool FileExists(string virtualPath, NameValueCollection queryString)
    {
        if (!virtualPath.ToLower().Contains("imagehandler"))
        {
            return false;
        }
        _imageVirtualFile = new ImageLocalFile(queryString);
        return _imageVirtualFile.VirtualPath != null;
    }

    public IVirtualFile GetFile(string virtualPath, NameValueCollection queryString)
    {
        return _imageVirtualFile;
    }

    public IEnumerable<string> GetSupportedQuerystringKeys()
    {
        return new [] { "id", "width", "height" };
    }

    public class ImageLocalFile : IVirtualFileWithModifiedDate, IVirtualFileSourceCacheKey
    {
        private readonly ResizeSettings _query;
        private readonly int id;

        public ImageLocalFile(NameValueCollection q)
        {
            _query = new ResizeSettings(q);
            id = _query.get("id", 0);
            VirtualPath = path of file based on id
        }

        public Stream Open()
        {
            return new FileStream(VirtualPath, FileMode.Open, FileAccess.Read);
        }

        public string VirtualPath { get; private set; }

        public DateTime ModifiedDateUTC
        {
            get
            {
                return File.GetCreationTimeUtc(VirtualPath);
            }
        }

        public string GetCacheKey(bool includeModifiedDate)
        {
            return VirtualPath +
                   PathUtils.BuildQueryString(NameValueCollectionExtensions.Keep(_query, "id", "width", "height"));
        }
    }
}

```

And this is what I have in web.config

```
<modules>
    <add name="ImageResizingModule" type="ImageResizer.InterceptModule" />
</modules>
<rewrite>
    <rules>
    <rule name="ImageHandler">
        <match url="^imagehandler.*" />
        <action type="Rewrite" url="imagehandler.jpg" />
    </rule>
    </rules>
</rewrite>

<resizer>
    <plugins>
        <add name="ImageUtilities.MyImageResizerPlugin" />
    </plugins>
    <clientcache minutes="10080" />
</resizer>

```