Creating Transparent PNG Images in GD

March 27th, 2007

For a project at work I had to create a true colour PNG from scratch using GD, copy a load of image files to it from various locations and then display it on-screen.

The code to create a transparent PNG turned out to be a litle complicated:

    <?php
    // create a true colour, transparent image
    // turn blending OFF and draw a background rectangle in our transparent colour
    $image=imagecreatetruecolor($iwidth,$iheight);
    imagealphablending($image,false);
    $col=imagecolorallocatealpha($image,255,255,255,127);
    imagefilledrectangle($image,0,0,$iwidth,$iheight,$col);
    imagealphablending($image,true);
    // ^^ Alpha blanding is back on.
    // insert image manipulation stuff in here

    // output the results...
    header("Content-Type: image/png;");
    imagealphablending($image,false);
    imagesavealpha($image,true);
    imagepng($image);
    ?>

Important Note: If you output the image direct into the document stream as this example does, the PNG fix that uses bahaviours won’t work as it’s not a true PNG. For that, you’ll have to drop the header and give imagepng() a filename and show that file. Seems to work fine in other browsers, however.

Virgin Broadband Speed Increase

March 24th, 2007

Had a letter from Virgin Media this morning saying that by Virgin Broadband package will double in speed from 10Mb to 20Mb from May 1st, with a £2 increase in fees to help fund it the increase. I’ve read elsewhere that the Upload Speed would increase to 768Kb, which is getting very useful indeed. Virgin Broadbans Quoters have given all the usual useless comparisons of speed like ‘An MP3 file could be downloaded in just 2 seconds’.

Recently my Virgin Broadband (previously NTL) connection has been working extremely well – possibly to a realignment of a dodgy cable somewhere in the house – so a fully-maxxed 20Mb connection would certainly be interesting and some Broadband Speed Tests wil be required. I still have the original Motarola Surfboard modem that I got back in the days when it was Diamond Cable.

MySpace Phishing Scam Prompts Website Removal

March 17th, 2007

Over the past few days I’ve had over a million hits from MySpace.com – thousands and thousands of users clicking a link that leads them to a d04.net page. The page explained that the link they’d clicked had been disabled because it had violated our terms and conditions. Straightforward enough, right?

Evidently not for the MySpace crowd! I had hundreds of emails showing a varying level of spelling ability, all asking me why their precious MySpace pages had been blocked. I hadn’t blocked a single person’s MySpace page you understand – just the link to the fake site.

For doing this, I’ve been called a spammer and a hacker. I’ve been told I suck and that people are fed up with my shit. I’ve witnessed a whole gamut of badly-written pleading as people cry about their MySpace, claim they didn’t do anything and won’t ever do anything like it ever again, honest. I’ve even had people send me their login details asking me to fix things – what the hell’s wrong with these people?

So anyway, d04.net is now offline and will remain so until I can be bothered to rewrite it all, making it even more restrictive and even more hassle for me to run – all because some people on the Internet can’t be trusted. And this is why we can’t have nice things.

You’ll understand why I’m in no rush to resurrect it.

UPDATE: (Actually it’s now Sunday, but what the heck)

It appears some of the MySpace users who can’t read a URL have reported d04.net to McAfee Site Advisor which redirects you to a page reading:

    “d04.net/ may try to steal your information.
    Why were you redirected to this page? We believe this site may be
    trying to trick you into entering your financial or personal
    information. This is a serious security threat which could lead to
    identity theft, financial losses or other dissemination of personal
    information. “

I’ve emailed them with an explanation and hopefully they’ll have a real live human with a working brain look at the situation and … ah who am I kidding?

UK Government goes Big Brother

March 11th, 2007

It doesn’t matter who’s in charge anymore, the UK Government seems to want to track everybody at all times, and they’re trying to fix it so you don’t move about too much while they’re at it. It’s not enough that the UK has a CCTV camera for every 14 citizens – in the last year or so it’s really getting Orwellian.

It started with ID Cards and Biometric Passports linked to a Big Brother-style Identity Database where everything they can glean about you will be recorded and cross-referenced in the name of “fighting terrorism”.

The Government wants to track every car via satellite, ostensibly to charge you more for using congested routes at peak times. Tracking and recording the movements of the UK’s 26 Million cars would allow them to find anyone quickly and easily and give a list of where they’d been. They already have a system using a network of cameras watching central London that can track every vehicle entering the area and look up the registered owner.

Now they want to tax domestic flights to help the environment. With the increase in flight costs, people will move to (tracked) car journeys or be forced to use the UK’s crappy, and frankly unsafe rail network. How long before you need to show your compulsory ID card to board a train “to fight terrorism”?

And according to the present Government’s own man in charge, James Hall, you soon won’t be able to leave the country if you don’t agree with these measures, even if you want to leave the country precisely because you don’t agree with them.

Internet Wobbles

March 6th, 2007

Some serious lag on the Intenet this morning – we could barely connect to anything but the office router, and when we could connect it was slow as a sloth in treacle. I disconnected and reconnected, rebooted the router and generally cursed a bit, all to no avail, seemingly.

Then after half an hour of crawling it’s all back to normal – email, web and so on are all at normal speed. Did anybody else notice anything or was it just us?

Cheapo Compass via Froogle

March 5th, 2007

Something else I just remembered. I decided to buy a compass for my forthcoming jaunt up Ben Nevis but I didn’t actually want to spend any money. Mooching around Froogle I found one from Iron CLad Outdoors for the princely some of £1.00 including postage.

Oddly enough I can’t find the same item if I go through their website, which leads me to suspect that the offer is a leftover from a recent Froogle promotion which has been forgotten about. Maybe, maybe not, but if I get a compass for a quid, I’m not going to complain. As it happens, I had £1.60 in my PayPal account and they take PayPal, so double-bonus!

Why buy one in the first place? Well although there’s a path up to the top, it’s entirely possible to forget which way you approached the summit once you’re up there, especially if it’s foggy cloudy. A quick squiz at the ol’ needle once the path ends will give me some clue as to which way to go in order to get back down. It’s either that, or wait for someone else to turn up and see which direction they came from.

New, Harsher Penalties for using Mobile Phone while Driving

March 5th, 2007

As you may or may not have heard on the news recently, the penalty for using a mobile phone while driving has increased from a £30 fine to £60 and 3 points. Get caught four times and you win a pushbike, so to speak.

So I spent half an hour digging through the piles of (“Interesting” – K.) crap I’ve accumulated over the years and found my old Plantronics 3000 Bluetooth headset, or hands free thingy. I dusted it off and stuck it on charge and it works just fine. In fact it works better with my K610i than it ever did on my k750i, which would frequently cut out halfway through a conversation, and which was the reason I threw it onto the pile in the first place.

Of course, all this legislation is a load of wank when we already have such laws as “Driving Without Due Care and Attention” – a law that lets the police bust you for anything, not just mobile phone use. Applying your makeup? Check! Fiddling with the stereo too much? Check! Eating an Apple? Che- oh wait…

But no, the Labour government loves making new laws. It’s almost as if they’re on performance-related pay or something. K was telling me just last week that they’ve introduced a new law for every day that they’ve been in power. However did we cope without them? The country must have been in downright anarchy.

But I digress. Get yourself a Wireless Hands-Free thingy for use while driving. Don’t use them while walking around town, however, because they tend to make you look a bit of a pillock.