I have spent the last couple days testing and using what I call the “Smug Mug Image Handler”. The code is still what I would consider Alpha release quality but it does work :) What is the SmugMug Image Handler? It’s a .NET Handler page that loads image data from SmugMug (via their API) and displays it as an image on your site. (See the previous post for reasons why I started working on this.)
Here are the current features implemented:
- Ability to load images from Smug Mug using the Smug Mug API.
- Support for loading all of the currently supported image sizes.
- The Handler attempts to block “Image Hotlinking” using a white list referrer mechanism. The code allows only NULL referrers or domains which are on the white list to load images with the handler.
Here are a few of the known issues:
- The code only supports jpeg images.
- The referrer mechanism/”hotlink protection” (mentioned above) may be overly protective. I am still looking at the right way to solve this issue.
- The code does not use any filesystem caching at the moment. If your browser didn’t cache the image data then it’s loading the content fresh from SmugMug each time.
- The code only supports login via password hash at the moment. I will add login with username/password if people need this.
Interested? Great – here is what you need to know to use the code.
- The code is licensed under the BSD license.
- To use the code you must add the following items to your web.config file:
<add key="SmugMugPwdHash" value="" />
<add key="SmugMugUserID" value="" />
<add key="SmugMugApiKey" value="" />
<add key="ImageHandlerReferrerWhiteList" value="yourwebsitegoeshere.com|google.com|bloglines.com" />
- Each key should be fairly self explanatory. Please note that the WhiteList key values must be separated by a “pipe” symbol “|”
- The Zip File contains a web.config file. You can safely delete this and just add the keys above to your own web.config. I left the web.config in the zip just for demonstration purposes.
- To use the Image Handler you specify the image options via a query string:
ImageHandler.ashx?imageid=[imageid]&imagekey=[imagekey]&size=[size]
Size can be one of: tiny, thumb, small, medium, large, xlarge, xxlarge, xxxlarge, original
You can download the current code here. Please use at your own risk – as mentioned above this is not release quality. I would appreciate any feedback you have if you end up using the code!