Posts tagged with “PHP”
For the last ten years or so, I used to turn on my PC when I came home from school or work and shut it down again right before I went to bed. So most of the time when my PC is running, I'm awake. I've also been idling in IRC for as long as I had Internet – when my PC is running, so is my IRC client.
I still have all my IRC logs since 2001 lying on my HDD. The log format of mIRC changed slightly over the years, but it's all easily parsable with some basic Regexp. I quickly wrote a PHP script that extracts the Session Start and Sessions Close markers and timestamps from these logs and transfers them into an image.
Open image in a new window
As you can see, I tend to stay up late. I also tend to go into a free-running sleep mode when I don't have to get up early every morning. At May 2004, after my A-Level exams and before my apprenticeship started, I “rotated” my sleep cycle three times. This has been even more extreme for the last two years, where we only had few lectures in university but instead worked on a lot of projects. I should really get one of these daylight lamps.
There's so much more interesting information hidden in these IRC logs. Maybe I can bring myself to parse and import all of them into a database, so I can run some simple queries on them. Maybe I can even find my pre-2001 IRC logs on some backup CDs.
Avatars are important. They are everywhere and there is virtually no community driven website out there, where you can’t upload an image of yourself or what you want to be associated with. These images help us to immediately recognize our friends without even having to look at their names.
We don’t care too much about what is depicted, but how it looks: the overall color and shapes. Yet, all the default avatars of our beloved Web 2.0 sites look exactly the same. And while Twitter’s default Avatar can at least be considered cute, most others are dull and unimaginative.
Why not create a unique image, based on the users name, on the fly? This avatar could be temporarily used till the user can be bothered with uploading one by himself. This would give even the laziest user a chance to be instantly recognized by his friends.
My InstantAvatar PHP class does exactly this: it generates (more or less) unique avatars on the fly. Here are some examples of what it can do:

Read complete post »
As of today, Picturelicious – the PHP Script that drives lowbird.com (an old version) and pr0gramm.com (nsfw; an even older version) – is now for sale. This is the first time I’m really trying to sell some of my stuff as software, so let’s see how this works out.
Packaging up something for a public release always means work, lots and lots of work. Asaph was no different and I was not even selling it. This time I had to be even more thorough. $700 is a lot of money, so I made sure I’d have a proper readme, all configuration variables are documented, the code is cleaned up and the script is really worth what you’re paying for.
I implemented a Paypal button to receive payments for Picturelicious; it really made me wish for an App Store. I do have the feeling that I will complain a lot about the App Store once I try to sell Yuckfu for the iPhone, but for now, Paypal sucks. It’s unbelievably complicated for the vendor and the customer. It tries to please everyone, but ultimately only confuses with too many options. Luckily, the software I’m selling only appeals to people who probably know how to use Paypal. But let’s not blame Paypal; let’s blame the W3C or whoever was to lazy to work out how the 402 HTTP status could be put to use.
Ever since this blog went online I used Favatars to make it more easy to recognize authors of comments. I think this worked out really well for my site, as many visitors have their own websites and favicons. However, despite Paul James pointing out that Cool URIs don’t change, I had more and more 404s when I viewed my site. All of these resulted from favicons that weren’t there anymore.
To fix this, I wrote a small PHP5 class that attempts to download the favicon from the commentators website. This class is very conservative – it stops a download if it’s bigger than 50 kb, has a short timeout, only allows PNG, GIF, JPEG and ICO extensions and silently returns if there’s any error. Here’s how you can use it:
// Create a new Favatars object and tell it to save
// all favicons to files/favatars/
$favatars = new Favatars( 'files/favatars/' );
// The get method attempts to find a favicon for the given
// URL and returns the local path of the downloaded favicon,
// or an empty string if none could be found.
$comment['favatar'] = $favatars->get( $comment['website'] );
Read on to view the source of this class.
Read complete post »
After two Beta versions of Asaph, here is what I call Asaph 1.0. This is the first proper release, even featuring a readme file and licensing information (GPL v3).
If you’re new to Asaph, watch the screencast on Vimeo.com to see what’s it all about. My own Asaph blog can be found at asaph.phoboslab.org.
Many issues with the RSS-Feed and bugs when editing posts from the admin menu were fixed in this release. I also included another template theme called Stickney which can be activated in the config file.
Download: Asaph version 1.0 – ZIP ~50kb
If you’re updating from a beta version, simply replace all your files (keep the data/ directory!) and edit your settings in lib/asaph_config.class.php. The database layout didn’t change, so there’s no need to invoke the installer.
Read the Asaph project page to learn more.
Based on the wonderful feedback I got on my last post, I just put together a new beta version of Asaph. It fixes the most common problems people had with the last one. This includes:
- Usage of cURL or url fopen wrappers, based on what’s available
- magic_quotes are now reverted automatically
- The RSS Feed should now display images properly
- Lots of smaller bugfixes
Again, to install just unpack the zip, enter your database settings in lib/asaph_config.class.php, upload it to your webserver and point your browser to admin/install.php.
If you already installed the previous version, just replace all the files and skip the install step, as the database layout didn’t change.
Asaph version 1.0 – ZIP ~50kb – Updated: Asaph version 1.0
I have some more plans and ideas for future versions of Asaph. Don’t hold your breath though – this will take some time :)
Over the past few weeks I developed Asaph – a small blogging system, that allows you to instantly post links and images directly from any page on the web. This makes Asaph the most fun to use application if you want to collect and show all the cool things you found elsewhere. Asaph is not a full blown blog and it does not aim to be one – it just does this one task, but it’s pretty good at it.
Watch a screencast to learn what makes Asaph worth using: Asaph Screencast on Vimeo.com
My own Asaph blog can be found at asaph.phoboslab.org.
Asaph is currently in Beta stage. It needs PHP5 and MySQL4 to run. To install, just unpack the zip, enter your database settings in lib/asaph_config.class.php, upload it to your webserver and point your browser to admin/install.php.
Asaph version 1.0 – ZIP ~50kb – Updated: Asaph version 1.0
Feedback is much appreciated!
As Tag Clouds become more and more common in blogging systems, one wonders why this intuitive approach hasn’t been used for other media types like images or videos (or video previews).
The idea to scale elements in their relevance of importance is not new, however it wasn’t possible to do this with images in websites so far. HTML and CSS offer no direct mechanism to position images of different sizes in a pleasing way.
To solve this problem, I developed a simple PHP script that calculates sizes of DIVs based on their importance and arranges them in a fixed-width grid, while closely maintaining their order. The grid is pre-generated by PHP with a width of 768px in order to fit on small screens, but scales with the help of JavaScript to fit in any browser window.
Here’s a demo of how this actually looks in action: Grid-Solver Demo
Read complete post »