Blog Archives

Doctrine PHP Merge Function

If you’ve tried Doctrine PHP, you might get pretty frustrated when using the $Record::synchronizeWithArray() function. Why? $data = array(‘name’ => ‘jimbob’); $User->Doctrine::getTable(‘User’)->find(1); $User->synchronizeWithArray($data); $User->save(); If you try this code you will find that the synchronizeWithArray() function deletes everything except the ‘name’ field in the record. I think the name ‘synchronize’ is slightly confusing here, as [...]

PHPMailer and HTML email

If you haven’t already tried it, the PHPMailer class is an excellent way of sending email using PHP. It makes all those dreaded email tasks (multiple message parts, encoding, attachments etc.) really nice and easy. Today however I came across a problem sending HTML formatted email – only occuring when sending via the PHP mail() [...]

JQuery Multiple file upload

I’ve been on the hunt for many years for a decent way of uploading multiple files at once via a browser-based upload form. Finally there is one that seems to do a great job, and be fairly easy to install – the JQuery Uploadify plugin. There’s a couple of ‘gotchas’ that I came across and [...]

A noob’s guide to PHP Doctrine

This week I am a newbie to PHP Doctrine. So I thought I’d share some of the experiences I’ve had with it, not so much in a coding sense but in a “this is the cool stuff you can do with it” sense. Doctrine is an ‘object relational mapper’ or ORM for short, letting you [...]

Object Oriented Hook Management in PHP5

One of the nice features of WordPress is the plugin system, where ‘hooks’ allow custom functionality to be added without monkeying around with the core functionality. I haven’t played around with this myself yet, but from what I could gather from the documentation, it does this using functions which are all defined in the global [...]

Mosso Cloud Files API with Windows

I spent a while tearing my hair out today trying to connect to the Mosso Cloud Files API with PHP. It seemed to be authenticating OK, but I couldn’t create a container. The error I got was “Failed to obtain http response”. It appears as though this has to do with CURL and SSL on [...]

A JPEG to PNG Processor in PHP

So for our new CMS project I needed a way to turn a logo as a JPEG on a white background, into a transparent PNG. This didn’t turn out to be particularly straightforward, as due the JPEG compression, the white part of the image is noisy. So it was quite tricky to cut out the [...]