Dale's Weblog

looking back it was easy.
Sunday 05 September

GD images.

Posted by Dale on Sat, 03 Jul 2004 09:27:11 EST

Okay I’ve fixed up the look of my news layout. Now with funky GD images for the news headings. Each different news item is better defined. I might do some more work on it today, although there are lots of other things I should be doing! We shall see.

EDIT: Testing admin panel with sessions. Seems to be working well.

Below are the comments for this news item

Don't mind the images thing, although please pick another font, otherwise the whole thing is pointless and you should just define a set-width DIV element and center text within that with the news background image being the background of that element also, and save bandwidth.

The centered news on the front page sucks, though, imho ;)

What font is "News" in your base image written in? Oh and it may be worth setting border=0 in your image tags for the news things… unless you like the hover blue border thing.

J.

1: Comment by J. - Sat, 03 Jul 2004 10:15:27 EST


Okay fixed up. The font I use is verdana.

2: Comment by dale - Sat, 03 Jul 2004 10:42:33 EST


Funky. How much of your layout is hardcoded into the news script, just out of curiosity? Mine is tied in too closely - it'll accept multiple styles as a directive for the purpose of having different background images for the news titles, but ideally I would be able to define a custom config file in each style which would then alter the layout of the news accordingly… something I want to do eventually, but how is yours?

3: Comment by J. - Sat, 03 Jul 2004 10:46:57 EST


Oh no mines just hard coded. Although I was thinking of making it load a different text colour based on the time(); function. We'll see.

4: Comment by dale - Sat, 03 Jul 2004 10:50:55 EST


Whoa. Lemme know how THAT goes… output from time is… 11 chars? hmm… 11 chars… convert base10 to base16… that's like 8 chars… so truncate the string to 6 chars (or, if this colour is for something GD related, use the last two chars for alpha) and then use it as a colour… yeah, that could work.

Hehe. You can work out the maths, though ;)

5: Comment by J. - Sat, 03 Jul 2004 10:57:08 EST


Okay done. It only changes the font colour atm. I'll do more with it later.

<?
header("Content-type: image/png");
$string = $_GET['text'];
$time = time();
$output = strftime ("%y0", $time);
$output1 = strftime ("%S0", $time);
$output2 = strftime ("%m0", $time);
$im = imagecreatefrompng("../images/news.png");
$black = imagecolorallocate($im, $output, $output1, $output2);
$size = 9;
$angle = 0;
$left = 75;
$bottomleft = 20;
imagettftext ($im, $size, $anglee, $left, $bottomleft, $black, "e:\php\fonts\verdana.ttf", $string);
imagepng($im);
imagedestroy($im);
?>

6: Comment by dale - Sat, 03 Jul 2004 11:14:38 EST


Hmmm… the effect is trippy (coz the images take a while to all load, as you scroll down the page the font colours are actually different, because they were generated with a different stamp! Imagine the effect on dial-up!), but the code seems a little… hmm. Yeah, a little dodgy. R, G, B - the green channel is fed by seconds, and will therefore be the most changing, no? Hmm. My splitting a number concept doesn't work too well, either, i guess… grr.

so… how about you just generate three random numbers between 0 and 255? screw this time() business! yeah. that would make more sense, i think.

7: Comment by J. - Sat, 03 Jul 2004 11:34:54 EST


Yeah I might, gives me more control over the numbers. But remember randomising is done based on the computer time anyway (not just php related).

8: Comment by dale - Sat, 03 Jul 2004 11:52:32 EST


yup, that's fine - just remember, though, at the minute only green is a highly volatile number; if you generated individual random numbers for all numbers, then all three would be… if that makes sense…

9: Comment by j. - Sat, 03 Jul 2004 12:05:07 EST


Ok done the random number thing. Looks better ;) Thanks.

10: Comment by dale - Sat, 03 Jul 2004 12:24:27 EST


Done a fair bit of work on the admin panel. Now interfaces with the website a lot better. Sessions and everything ;)

11: Comment by Dale - Sat, 03 Jul 2004 23:56:07 EST


BBCode:

urls become clickable

[b]place text in bold[/b]

[i]place text in italics[/i]

[quote]place text in a quote[/quote]

Comments? Please note that all HTML tags are removed from your post.

The URI to TrackBack this entry is: http://www.dalegroup.net//early05/archive/blog/newsid/trackback/30

Comments

Message:

Name (optional):

Email (not shown):

WWW (optional):






Copyright © Michael Dale 2004. Page generated in 0.0055 seconds FreeBSD Powered
Background on style 5 is used from squidfingers How are we going? 3 queries