Img Notes v0.2 – a couple of bug fixes and some more

Since the publication of the first version of Img Notes jquery plugin there was very little that needed to be done and the plugin itself has had more than 10,000 downloads, however there was one bug which I never got around to fixing and that was properly repositioning the notes on the image if the window was re-sized, that is till a couple of days ago when I needed to do exactly that - your bad code always catches up with you!!

Without much ado the new version has precisely 2 bug fixes

  1. Re-positioning of notes when the window is resized
  2. An issue with the z-index of the notes which led to some over-lapping

Demo here
Download here

One thing which has often been requested is the ability/interface to Add notes on the images (rather than just display). This was deliberately left out as I wanted to keep the implementation very simple and adding notes permanently cannot be a pure javascript solution.

However I would like to share the concept behind javascript code of the way I have implemented the add notes functionality - It relies on the excellent ImgAreaSelect plugin which allows for interactive selection of parts of an image. The impatient can just view the source of the demo file and figure out, the example file is also included in the zip file - those of you who need a bit of help with it, read on...

  • The page has a form with appropriate fields which is hidden by default
  • The window.load() apart from initializing the Img Notes binds 2 more events, the first with click on Add a note line to show the ImgAreaSelect and second to hide ImgAreaSelect when cancel is clicked
  • The call to show ImgAreaSelect can take a callback function for onSelectChange, here the function showaddnote is specified with some sensible defaults, you can read the excellent documentation on the ImgAreaSelect web page to know more about it
  • Well that is more or less *it* the form submission in my case is handled as a regular post to a CakePHP controller, you can try some more funky stuff like using AJAX for submission - let me know if you do

As the current implementation stands I see it as feature complete for my needs but suggestions for improvements, bug reports and patches most are most welcome.

If you are new to this plugin you may want to take a look at how to use it written about in this post


About this entry