Question

I stumbled upon the ImageResizer from ImageResizing.net and am wondering how I would integrate this with my website. We have a lot of files \ images that we consider opened to the public and then we have others that are private. We have all of our images in a secure folder on the webserver not accessible via the url and we have a database that links to these files. We use a web handler (ashx) to deliver the image to the user (Web pages etc) because the rules on if a user is allowed to view a file is a lot more complex than just what role they belong to. For instance some images are only viewable to users we have sent a request to (the DB holds this relationship info). We don't store the files/images in the DB as Blob because this would greatly increase our DB size (using the SQLServer Express so need to stay under the 10GB limit) plus I think it would cause a performance impact but I could be wrong. With that said what is the best approach to using the ImageResizer?

I read some about the IViertualImageProvider and I think I would have to write a plugin using this format (http://imageresizing.net/docs/extend/virtualimageprovider). Would I just put in my authentication / authorization logic here to determine if an image is delivered or not. Is there a better way? Has someone already built a plugin for this scenario?

Était-ce utile?

La solution

This is called Authorization. You can implement authorization logic in your HttpApplication or IHttpModule's AuthorizeRequest event.

ImageResizer also offers a AuthorizeImage event that only applies to processed images. If your images are on the file system or provided by a VirtualPathProvider, they're accessible without going through ImageResizer, so you should use AuthorizeRequest approach.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top