Introducing the WRGprettyPhoto BlogEngine.NET Extension

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:

  1. Download prettyPhoto (minimized version recommended) and extract the prettyPhoto folder in the archive into the root folder of your website.
  2. Download the WRGprettyPhoto archive and copy the WRGprettyPhoto.cs file from the WRGprettyPhoto archive into the App_Code\Extensions folder.
  3. 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.
  4. 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:LiveWriter_LightBox_Support 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!

Moving Forward

25. May 2010 18:22 by gogman in BlogEngine.NET, General, Open Source  //  Tags: ,   //   Comments (0)

benlogo80[1] I have been blogging on and off since 1996. I have always used a CMS that I have written myself. About three years ago I had finally had enough with blogging and converted my website over to a simple page with some image galleries and my Twitter feed.

Fast-forward a few years and once again the blogging bug returns. This time however, I wanted to concentrate on writing words and not a brand new CMS.

So I began looking around the Internet for a suitable system that met three simple requirements:

  1. The application should be open source, have the source code available, be .Net based, and be in active development.
  2. It must be secure, well written, extensible, and be standards compliant.
  3. It must support XMLRPC functionality so can use a WYSIWYG editor – in this case Microsoft's Live Writer.

I thought these requirements were going to be impossible to meet and I am happy to say I was wrong. So very wrong! There is BlogEngine.NET!

After spending a few weeks playing around with BlogEngine.NET and going through the code, I have to say I am very impressed. This is a remarkably robust and well written application. The user community is quite active and the development cycle is regular and ongoing. The data storage support is quite robust and supports everything from XML to SQLite. The application platform is highly extensible and remarkably easy to write for. All in all, I highly recommend BlogEngine.NET for all your blogging needs.

About the Blogger

aBorn naked, unable to communicate, walk, or feed himself, Gogman overcame these handicaps to become a technologist, decent open water sailor, pretty darn good cook, husband, cat lover, and mediocre blogger.

Gogman works as the CTO at Atomic Goat Studios, an independent game studio start-up located in Southern California developing games for the PC, XBox 360, and Windows Phone 7.

Recent Comments

Comment RSS