Archive for category PHP

Google Images Link Improver WordPress Plugin

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 for “earthrise”. The user clicks the following images result:
… and here’s how the clickthrough page looks:


Before Plugin Installation

After Plugin Installation

Read the rest of this entry »

, , , , , ,

1 Comment

PHP ImageStringRight / Center / Italic

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.

PHP ImageString Enhanced!

Image String Enhanced!

Demo and source code after the break!
Read the rest of this entry »

, , , , , , , , ,

11 Comments

PHP 4/5 Image Blur

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 »

, , , , , ,

6 Comments

PHP Digital Camouflage

The other day I was looking at 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):

Woodland Digital Camo Urban Digital Camo
Desert Digital Camo Nighttime Digital Camo

The Online Demo generates larger camo patterns and has a few other camo types; refresh it to cycle through them.

Download PHP Source

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 »

, , , , ,

2 Comments

3D PHP – playing with ImageCreate

A PHP city (it gets better after the break):

PHP ImageCreate

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:

Read the rest of this entry »

, , , , , , , ,

10 Comments

PHP Winamp Randomiser

A PHP script that will play random mp3s from a specified directory. This script has -only- been tested with the following configuration: Winamp 5.02, PHP 5.0.2, Apache 1.3.29. It may or may not work on other config, and as with much of the code here, is pretty much a proof-of-concept rather than a neatly packaged-up application. Read the rest of this entry »

, , ,

No Comments

Anti-Spam Email PNG

This is a simple way to display your email without fear of it getting picked up by spammers; it creates an image of the email address you send it. To be honest, I don’t think in this day and age spammers spend huge amounts of time trawling through gigs of websites looking for email addresses so all this “howard DOT yeend AT gmail DOT com” stuff I think is largely futile – have you experienced a drop in spam since obfuscating your address like that? Thought not. But hey, if you want to see how to write strings in PHP, check out the code :) Read the rest of this entry »

, ,

5 Comments

PHP HTTP Interface

This code give you a HTML front end for HTTP using PHP. I quite often find myself wanting to fire up putty to send some custom HTTP headers, so I wrote this simple PHP tool to provide a “front end” for HTTP. It allows quick and easy customisation of HTTP headers, sends them to a web server and shows you in plain text the HTTP response headers and body. It’s quite nifty and rather useful for debugging / hacking / etc. Read the rest of this entry »

, , , , ,

6 Comments

PHP Bar Graph / Bar Chart

This script allows you to create a simple dynamic horizontal PHP bar graph / bar chart from session data. With labels, colours, and many other customisable features. Great if you just want a simple PHP chart with no fuss.
Read the rest of this entry »

, , ,

14 Comments

GD fontmaker

This free PHP code creates GD fonts for use with PHP’s ImageString function. It takes a PNG as input and creates a GD compatible font from it. The online demo includes an example PNG and detailed usage instructions.

Read the rest of this entry »

, , , , ,

7 Comments