Web Developer
UX
Cropping images with CodeIgniter and jQuery
Aug 27th
The art to having a website with decent imagery is to allow the user/administrator to crop the images. Despite advancing web technologies, I still cannot trust a computer to scale, resize or crop an image without the resulting image being of someones foot.
There are certain ‘off-the-shelf’ products, mainly for ASP.net, with very little introduced into PHP, so I had to build my own using helpful libraries and plugins.
The Cropping
Writing a JavaScript cropping tool from scratch is no small challenge, getting a bug-free environment where all of the calculations are perfect can take weeks of hairless programming sessions and various mental breakdowns! And with my hair still in tact and mental capacity intact I implemented jCrop (I let someone else do the hard work). I am continuously reminding people that reinventing the wheel is both a waste of time, energy and sanity but the odds are against you. If a plugin is popular then the chances are that their solution will be 10 times better than yours as theirs have probably evolved over several months if not years!
Ajax callback validation routines with CodeIgniter
Mar 21st
The CodeIgniter Form_Validation library is an extremely useful tool especially the ability to extend all core routines. Some validation requires real time PHP & MySQL processing, for example checking an email against those already registered with your site.
To use a PHP function to return values to the jQuery validate function, the only important theory to understand is that the function needs to echo, not return. Returning values will not send the output to the DOM and so the validation routines will not know what to do with it.
Client side searching with jQuery
Mar 20th
In my previous post about sorting data I explained the brilliance of client side sorting using jQuery. When researching various other jQuery plugins I discovered tablesearch which can be invaluable when searching smaller data sets.
As in my previous jQuery post we will start with a standard HTML table, giving it an id of “myTable” of course if you wish to use multiple instances on the same page a class is a far more elegant solution.
Sorting table data with jQuery
Mar 18th
A plugin for jQuery called “tableSorter” makes life so much easier when you wish to sort certain columns on a table, for example filtering a table to make total amount (£) ASC or DESC.
The only HTML markup requirement is to assign the table with an id or a class in this example I have created a table like this:
<table id="sortingTable">
</table
JavaScript – experience enhancer or dictator
Feb 18th
A few days back it nearly ruined both my life and my sanity!
When I first started working as a commercial web developer the first idea that really hit me was the use of JavaScript and AJAX. My first senior developer always ranted on at me about ‘graceful degredation’ and I plodded along, blissfully unaware of the implications of ‘enhancing’ a website using JS.
The main issue that I was missing was that a very very very small percentage of users actually do browse with JavaScript disabled. “WHY WOULD YOU DO THAT?”, I thought. I fought for a long time with the idea that someone would actually purposefully disable a feature which makes browsing 10 times easier.