Archive for category PHP
Textpad PHP manual lookup tool
Posted by Howard Yeend in PHP, Productivity on February 1st, 2010
A little tip for those of us using textpad to develop in PHP. How often do you find yourself having to go back to PHP.net to check up on a function – is it ($needle, $haystack) or ($haystack, $needle)? I can never remember! With this tool I just need to highlight the function in textpad, press Ctrl-1 and up pops php.net in a new tab, opened on that function’s manual entry. Neat huh?
Here’s how:
GIFexplode – community powered web development
Posted by Howard Yeend in PHP, web on August 2nd, 2009
Let me share with you a very cool story about strangers coming together and building something.
I was browsing reddit yesterday, and I saw a thread entitled “Someone needs to make a Firefox add-on that lets you step through animated gifs frame by frame“. I thought “hey that’s a nice well defined simple idea” – just the kind of thing I love, so I registered a nice-sounding domain name and started looking at how to use PHP to split an animated gif into its component frames – I figured it couldn’t be too hard. Read the rest of this entry »
PHP Developer CV
Posted by Howard Yeend in (misc), PHP on August 1st, 2009
Howard Yeend (howard.yeend@gmail.com) – Experienced PHP Engineer
Availability
Not currently seeking work. Sorry!
PHP error handling
Posted by Howard Yeend in PHP on July 5th, 2009
Does this type of error handling code look familiar?
function doFunction($var) { if(is_numeric($var)) { /* do some stuff*/ } else { return -1; } }
BLEH. How ugly is that? There’s no indication whether -1 is actually an error or a valid return value, or what it means. And other functions might use false to indicate errors so there’s inconsistency. So I’ve written a very simple function to help you give meaningful PHP error messages.
Read the rest of this entry »
PHP 5.3.0 Released!
Posted by Howard Yeend in PHP on July 1st, 2009
If you’re still stuck in the old PHP 4 days, please please please take today’s release of PHP 5.3.0 as your cue to start learning about the wonderful world of object oriented PHP 5.
5.3.0 isn’t a hugely interesting release, but getting your PHP4 code compatible with 5 will ease the process when PHP 6 comes along. PHP6 is really where it’s at:
What’s out:
No more register_globals (finally)
No more magic_quotes (you kinda liked magic quotes? Admittedly it was handy, but when you think about it, having code that may or may not be sanitised depending on a php.ini setting is a Bad Idea™)
No more HTTP_GET_VARS and cousins. Just change to $_GET etc and you’re fine.
What’s in:
A bunch of minor fixes aaand:
Namespaces – so we can section off bits of code properly. Woohoo! more info here.
Short post today I know, but I’ve got some real coding to do :) If you’re not doing anything better, go download PHP and have a play with it.
Google Images Link Improver Wordpress Plugin
Posted by Howard Yeend in PHP, Wordpress on May 1st, 2009
Google Images Link Improver improves the way visitors find your site by redirecting hits from google images to more relevant content on your blog.
Here’s an example of how it works on an actual google images result for “earthrise”. The user clicks the following images result:
… and here’s how the clickthrough page looks:
![]() Before Plugin Installation |
![]() After Plugin Installation |
PHP ImageStringRight / Center / Italic
Posted by Howard Yeend in PHP on April 24th, 2009
PHP’s built-in ImageString function is OK, but I often find it lacking some of the basic features you’d expect. So I’ve created ImageStringRight, ImageStringCenter, ImageStringItalic, and a few other goodies for writing text to images in PHP.

Image String Enhanced!
Demo and source code after the break!
Read the rest of this entry »
PHP 4/5 Image Blur
Posted by Howard Yeend in PHP on April 21st, 2009
It’s not something that people require very often, but occasionally the need does arise and you have to ask: how do I blur an image in PHP? Here is some PHP ImageBlur code that works on PHP4 and 5.
What we end up with is a small fast function that can take a source image and create something like the following:
![]() No Blur |
![]() PHP5 ImageConvolution |
![]() No Blur |
![]() PHP4 myImageBlur |
In PHP 5 you can just use ImageConvolution and the code example right out of the manual:
$gaussian = array(array(1.0, 2.0, 1.0), array(2.0, 4.0, 2.0), array(1.0, 2.0, 1.0)); ImageConvolution($image, $gaussian, 16, 0);
That’s a nice Gaussian blur in PHP5 for you. But what about your nasty old PHP4 servers? I have the answer. Actually the answer is probably “use ImageMagick and a system call”, but if you want a pure PHP/GD solution, read on.
Using a crafty mix of voodoo and ImageCopyMerge, you can create a PHP 4 blur effect that is virtually identical to the PHP5 method, as you can see by comparing the results of myImageBlur with ImageConvolution above. In tests on my local server, my method takes on average 0.43 seconds to blur a 1024*768 image, while ImageConvolution takes 0.40 – so it’s basically the same, and half a second to blur a desktop sized image is pretty decent – on a live server it’ll be even faster!
There’s some more comparisons and the source code after the break:
Read the rest of this entry »
PHP Digital Camouflage
Posted by Howard Yeend in PHP on April 20th, 2009
The other day I was looking at demoscene videos on youtube (do yourself a favour and watch it!) and it made me think back to my PHP image hacking days. One thing led to another and I ended up saying to my partner Linds that I’d write her a little PHP demo. 3 hours later, I had digital camo in PHP (click the images for an online demo; refresh to cycle through the different types):
![]() |
![]() |
![]() |
![]() |
The Online Demo generates larger camo patterns and has a few other camo types; refresh it to cycle through them.
Let me know if you find a use for this code :)
After the break, I go into the detail of how the code is constructed, and you get a funky debug image too!
Read the rest of this entry »
3D PHP – playing with ImageCreate
Posted by Howard Yeend in PHP on March 19th, 2009
A PHP city (it gets better after the break):
Basically I was bored one day and decided to play around with ImageCreate and ended up making this “crate” demo (click the image for some other experiments).
And then everything got a bit silly and I made this:









