Categories
Uncategorized

On a Mission

It seems that I am on some kind of mission…

Right now I’m working on a few php scripts. The first of which is a simple little Image Gallery. It consists of 2 scripts and 2 folders (images and thumbs). The index.php script looks in the images folder for JPG or PNG files. Then it creates thumbnails for them and puts them in the thumbs folder. If a thumbnail already exists, then it doesn’t bother creating another thumbnail for it. Then the thumbnails are shown on the screen, and they link to the full size images in the images folder. Pretty straight forward. If you ever want to add new images just drop them into the images folder and the script does the rest.

There are no options for descriptions or anything. I don’t think I’ll do that, because then it defeats the purpose of being a ‘simple’ gallery. If I do, then I’ll have to set it up with a database, and pretty much rewrite the entire script.

The second thing I’m working on is a page to convert HTML (or any other kind of code, really) into its ‘special characters’ so the code can be posted up on a website. I call it HTML Safe HTML, because basically it converts HTML into a safe form so it can be presented on a website.

The reason I wrote this little script is because I had found a crappy little countdown (and countup) script and I wanted to post the code up on the site. Well, now I can do that:

<?php

/* input data for time to be counted down to */
$hour = 19;
$minutes = 30;
$seconds = 0;
$month = 10;
$day = 13;
$year = 2004;

/* countdown clock code */
$startDate = mktime ($hour, $minutes, $seconds, $month, $day, $year); /*Insert date to countdown to*/
$today = mktime();
$diff = $today – $startDate;

$days =(int)( $diff / 86400); /*86400 is # seconds in a day*/
$diff = $diff – $days * 86400;
$hrs = (int)($diff / 3600); /* 3600 is # seconds in an hour*/
$diff = $diff – $hrs * 3600;
$mins = (int)($diff / 60); /* 60 is # seconds in a minute*/
$diff = $diff – $mins * 60;
$sec = $diff;

echo "<center>";
echo "<b>Time without the NHL:<br>$days days $hrs hours $mins minutes and $sec seconds.</b>";
echo "</center>";
?>

It kinda takes up alot of space, but that is the jist of it. You can easily change the date it counts up from by modifying the variables at the top. All you require is PHP (i’m pretty sure it’ll work in version 3 and up — but its only been tested on version 4).

A 3rd and 4th thing I’ve been thinking of working on are other similar ‘utilities’ like my HTML Safe HTML script. One would be an image dump, where you can quickly upload and link to any images you have on your harddrive that you want to share with others. The other is a script where you can upload code, and it formats it with line numbers and stores it so you can show others. There are services that already exist that do the same thing, but I want to do it for myself, just to see if I can. Plus the other ones are full of advertisements so they can afford to offer the service. Since I’m already paying for my own, there is no sense in giving other people money.

Leave a Reply