All posts in Code

I’m currently in the middle of writing a reusable little JavaScript utility, which I’ll probably release when it’s finished, for one of my many projects and I wanted to employ unit testing as part of the development process, as I believe in the benefits of it quite strongly.

However my previous experience with unit testing JavaScript haven’t been the most pleasent, I have tried the most common nUnit variations for JS, the best of which was JSUnit. But I always found this a little cumbersome and difficult to use, however I had recently read about the unit testing available with script.aculo.us and although the only documentation I could find was the PDF available at mir.aculo.us I thought I’d give it a go.
Continue reading this entry »

I’ve finally released the latest version of the JavaScript Image Cropper UI which has been updated to version 1.2.0.

This adds quite a few bugs fixes, feature additions (the much requested ability to set maximum dimensions) and speed improvements and general streamlining.

NOTE: One really important change to note is that the cropper no longer has the default behaviour of automatically setting a ratio when both min width & height passed, the ratioDimensions must be now passed when this functionality is required.
Continue reading this entry »

For those of you who have had the pleasure of dealing with browser testing slightly complex CSS the title explains it all.

For those of you who haven’t, all I have to say is this: you lucky bastards.

Just a quick note to say that the JavaScript Image Cropper UI has been updated to version 1.1.3.

This adds the requested feature to allow you to set dimensions & position for the cropper on load, for example if you want to start the cropper with a previously selected area for a given image, say when the rest of a form this is part of doesn’t validate, this will allow you to do that.

As well as fixing a tiny bug in the CSS I’ve fixed a slightly larger one where pressing ‘remove cropper’ twice in IE removed the image from the source altogether.

I was hoping to get more things from the bug/feature request list into this release, but unfortunately I haven’t had time. As usual, please us the JavaScript Image Cropper UI code page to leave comments & bug reports etc. on the cropper UI.

I can’t believe how much attention and traffic I’ve been getting since I launched my JavaScript Image Cropper UI, the response has been amazing. The traffic is huge compared to what I was getting, and a lot more than I was expecting to get when I launched the site little over 8 months ago.

It has already had over 650 downloads with over 450 being of the latest version. I’m excited about the comments I’ve been getting on the cropper and I’ve been fascinated when following all the incoming links to the cropper to see where people are coming from and what people are saying about it.
Continue reading this entry »

Just another quick update to the JavaScript Image Cropper UI to bring it to version 1.1.2, this update includes a single fix to ratios. I had noticed when I put together the demo page and added the widescreen (16:9) ratio demo that there was something a little off in my ratio calculations.

This was brought to my attention again in a couple of comments by Andy Skelton, who also supplied a patch to the issue.

See the 16:9 ratio demo to see the patch in action or head over to the code page for the downloads.

Thanks again to Andy for submitting this patch so quickly.

Just another quick update to the JavaScript Image Cropper UI to bring it to version 1.1.1, this update includes the following:

See the demo page to test the new fixes or head over to the code page for the downloads.

I’ve just updated the JavaScript Image Cropper UI to version 1.1.0, this update includes the following:

  • Added method to reset parameters - useful for when dynamically changing img the cropper is attached to.
  • Added method to remove cropper from image.
  • Fixed bug with IE constantly trying to reload select area background image.
  • Applied a more robust fix to Safari & IE rendering issues.

I have also updated the demo page to include a new demo that uses the new ability to dynamically change the image or remove the cropper, this is also included as one of the tests within the downloads.

For a current project I needed a browser based image cropping user interface, I wanted it to have the same features as found in something like Photoshop and be based on the Prototype JavaScript framework and possibly script.aculo.us, as they are both being employed in the area this tool will be used, plus taking advantage of their power would reduce the weight impact of the interface.

I did quite a lot of searching for some ready made solutions and found none that had the complete feature set that I required or any complete versions based on Prototype, the closest I found was Encytemedia’s Prototype/Script.aculo.us Javascript Image Cropper, but this is far from complete.

So after a week and a half of work, I present the JavaScript image cropper UI, built on Prototype & script.aculo.us, there is also demo page which allows you to try out all the functionality of the image cropper UI.
Continue reading this entry »

Updated the PHPUnit2 HTML Runner to apply a fix provided by Glen Ogilvie for the Formatter when it tries to find the original exception that was thrown.

I also tided the Formatter up a bit by adding much needed comments to explain the functionality it provides in the context of the HTML Runner.
Continue reading this entry »