UPDATED 6 July 2010: WRGprettyPhoto 1.1 - contains minor bug fixes and reliability improvements - Download WRGprettyPhoto.1.1.zip – 3.72kb.
When I decided to adopt BlogEngine.NET as my primary website publishing platform, I knew there might be a few issues with the scripts I had been using on my old site. As I began testing, I discovered, much to my chagrin, that one of my favorite scripts – Lightbox 2 – did not work with BlogEngine.NET.
After a little research, I discovered that the incompatibility came down to a much used function in the JavaScript library for the blog sharing the same name as a function in the Scriptalicious library: function $(id) in the blog library and function $(element) in the Scriptalicious library.
I looked through both sets of code and decided that rewriting the code to use a different function name was just too much work and would complicate upgrading either set of scripts.
Deciding to find an alternative to Lighbox 2, I went to the extensions page on the BlogEngine.NET website and saw an extension named prettyPhoto. After visiting the author’s page and checking out the prettyPhoto javascript library website, I installed the extension and support libraries.
For some reason, the extension failed to work for me. I am not sure why it did not work, but it just did not. By this point I was set on using prettyPhoto so I manually set it up and got it working. It was at this point that I sadly realized I would no longer be able to use Live Writer’s built in Lightbox 2 editing support due to the different tag names used by prettyPhoto and the lack of the reference to the Lightbox 2 library on the site.
This got me thinking, why not write a prettyPhoto extension that not only “tricks” Live Writer into enabling support for Lightbox 2 but also works with that support in a smart way to enable prettyPhoto to use it. And while at at it, why not make it smart enough to only load the prettyPhoto library and the jQuery library only when needed?
After reading the BlogEngine.NET extension developer documentation, I jumped right in and after a few hours of learning, coding, and testing, I had my new extension completed: WRGprettyPhoto 1.0.
Download WRGprettyPhoto.1.1.zip – 3.72kb

Features:
- Enables and works with Lightbox 2 support in Windows Live Writer.
- Saves bandwidth by only referencing the prettyPhoto script when needed.
- Optionally saves bandwidth by only referencing the jQuery script library when needed.
- Complete control over the appearance of prettyPhoto from within the extension settings without ever needing to write code.
Setup:
- Download prettyPhoto (minimized version recommended) and extract the prettyPhoto folder in the archive into the root folder of your website.
- Download the WRGprettyPhoto archive and copy the WRGprettyPhoto.cs file from the WRGprettyPhoto archive into the App_Code\Extensions folder.
- Optional: If you use Windows Live Writer and want to use the built in support for LightBox2 with prettyPhoto, copy the file file lightbox.js from the WRGprettyPhoto archive into the prettyPhoto\js\ folder.
- Optional: If you already have the jQuery library script referenced in you site you may skip this step. If you do not and would like WRGprettyPhoto to dynamically load and unload jQuery as needed then download the jQuery Library (minimized version recommended) and place it in a folder on your site. I place mine in a folder off the root folder named Scripts.
Configuration Notes:
If you enable Live Writer Lightbox 2 editing support for use with prettyPhoto you MUST complete setup step #3 and refresh your blog settings in Windows Live Writer. Once you do this you should see the following when you click the options button after inserting an image into your post:
All you have to enter here is the gallery name for the photos you wish to display in prettyPhoto.
If you wish the have WRGprettyPhoto mange the loading of jQuery only when needed, you MUST complete setup step #4. The URL you enter must be a relative URL (eg: Scripts/jQuery.js) to the location where you have placed the jQuery library. A leading slash is not required.
The other options on the extensions page are pretty self explanatory.
Support and Licensing:
Please send me any bugs or feature requests you may have ASAP. You may either use the contact form or the comments on this post.
This extension is not licensed in any way and is given away free for you to do with what you will. All I ask is please keep the comment header in the extension source code intact and link back here if you improve upon or use WRGprettyPhoto as a base for your own custom extension.
Happy blogging!