Posts Tagged Image Loader

A Month Slipped By & Image Loader

A month apparently slipped by. So much for three posts a week.

Image Loader 1.2 seems to be doing well. I didn’t expect it to get used as much as it appears to be. I was just scratching an itch.

There are a few bugs out there for it apparently. I’m going to try to spend some time with it this weekend to push out a 1.2.1 version to fix them. They’re mostly in the category of “I’m using Image Loader with plugin X, but X doesn’t do Y”. To be expected with this type of plugin I suppose, but sure complicates debugging.

Tags: ,

Image Loader 1.2

I’ve updated my jQuery Plugin, Image Loader, to version 1.2. A couple of people asked that it maintain the order of the loaded images when added to the DOM. So now Image Loader does just that while maintaining the asynchronous downloading of images.

If you’re by chance using my plugin I’d love to see what you’re doing. I built it with the idea of using it with the Cycle plugin, but in a manner that you can use it with whatever you choose. So if you’re doing something different let me know.

Tags:

Fun with jQuery – New version of Image Loader

I released version 1.1. of my image preloader plugin for jQuery today. I’ve been having a lot of fun with jQuery on three different projects right now. I’m working on a tutorial which I hope to post here sometime next week on using jQuery to support nested data using ASP.Net MVC. Supporting nested data is actually quite easy with ASP.Net MVC but if you want to up the game and make the page a bit more dynamic you start juggling a lot.

On a different note I’m reading two great books right now. The first is Startup Nation, a look at Israel’s entrepreneurial efforts and why they appear to succeed. I’m about halfway through the book right now and really enjoying it.

The second book is a bit on the dry side it’s The Entrepreneur’s Guide to Business Law. It presents the material with a lot of “from the trenches” real world examples along with a fictional company walking through each stage where business law applies.

Tags: , ,

Image Loader – A Multi-Image Preloader jQuery Plugin

Last weekend I started my first jQuery plugin. It was for a piece of javascript I had used once and was about to use again and it occurred to me that this is exactly what plugins are for. Last night I finished it and released it on the jQuery Plugin site. You can see my apply named Image Loader Plugin on jQuery’s Plugin site right now. But I still made my own official site for Image Loader on my own site.

The plugin itself is fairly simple. You give it an array and it will load your images for you. I needed this because I recently used the jQuery Cycle Plugin for a slideshow for a client. The site loaded 20 rather large images and having the user just sit there and see nothing just wasn’t going to do, so some sort of loading splash screen was needed while images were loaded. And that’s what Image Loader does.

I approached this as an exercise to see what writing a plugin was all about and as a chance to write something that’s open source and supported for more than myself, basically to push myself in new directions. All in all it was well worth the time. Here’s few things I took away from this:

1. Turning my own code into a plugin for more than just myself forced me to look at the whole approach I took. So much so that I quickly changed how the plugin worked. It was originally made to only work with the Cycle plugin. So much so that it called it for you and you passed the options for the Cycle plugin as an option of the Image Loader plugin.

Dumb idea. 0 Extensibility? What was I thinking?

As I started turning the code into a plugin this just didn’t make sense. Why force myself into only one path? What if I want to use this for something other than this one slideshow plugin.

Now you provide a callback function where you can launch your own function. Here’s how it works.

	$("#slideShow").imageLoader({
	   images: ['images/image1.jpg'
		  ,'images/image2.jpg'
		  ,'images/image3.jpg'
		  ,'images/image4.jpg'
		  ,'images/image5.jpg']
	}, function(){
	   $('#slideShow').cycle();
	});

I’m quite happy I noticed this. And I don’t think I would have if I didn’t take this from the approach that someone else might find this useful. Even if no one else does it’ll save me time in the future.

2. As always it takes more than just code to make something. Once I had my plugin at a point I felt was release worthy I then needed to do a few things:

  • Give it a name! One that isn’t taken already… (hopefully)
  • Setup a page on jQuery’s plugin page.
  • Make a support and example page.
  • Package the whole thing up into a release.
  • Make a Twitter post about it.
  • Make a Blog post about it.

Really the only required things were the 1st, 3rd and 4th. But if I was going to do them I may as well do this the right way.

The name isn’t very creative, but I just wanted something that said what it did and wasn’t taken. I renamed it twice.

The project setup on jQuery is pretty quick and painless. It’s also customizable enough where you could honestly use it as your entire site. But since this is something I wrote I wanted people to see where it came from. Thus my own site as well. Anyhow you can’t do an example on their site.

Packaging it up was easy, but still I wanted this to be done nice so:

  • Pick a license. (I went with MIT)
  • Make a Read Me file.
  • Run YUI Compressor to make a minify version.
  • Clean up the style sheet and javascript a bit more.

3. Deciding when I had something release worthy was interesting. I already have two other features I’d like to add. Really I could have added these, but then I wouldn’t have a released plugin right now. And I would rather release often honestly. It’s not like this is for the iPhone and I won’t be able to get a release through the app store quickly. So this was great practice to start “releasing early”. Maybe I’ll release 1.1 tonight and practice “release often”.

4. Finally, I have the code on my computer here at home. No source control at all. Something I’ve been wanting to stop myself from doing lately. So I’m going to give GitHub a shot. Something else I’ve been wanting to do lately.

Like I said, this started as just an exercise to see more about jQuery plugins. But really it turned into an exercise to look at how I write software, a quick practice on getting something out the door and introduced me to GitHub too.

Tags: , , ,