Overly Chatty Penguins
The Ready Room => Media => Topic started by: devicenull on August 30, 2004, 05:54:22 PM
-
Basically I know what I'm looking for, I just suck with image stuff
very light grey background, silverish cylinders on the left and bottom, with some kind of ball at the joint, dunno about color, whatever. "devicenull" in the bottom left corner, the rest will be filled in by my php stuff :)
So anyone who wants to make this for me, that would be nice :p
-
Working now Grimm, hands off.
KK, done. Lossless PNG for the win. Can export to any format, still have the source, and can play with the lighting whenever.
-
Very nice, exactly what I wanted, except for one minor thing
The stuff outside the cylinders, can that be transparent?
-
Hey dev, could you send me that script? I'd like to take a look at it ^_^
-
Once I figure out how to wrap the stuff better (It works on my local server, not on my test server)
Here's the code though
<?php
//Released under GPL
//Copyright (C) 2004 devicenull (darkmage at snet dot net)
header("Content-type: image/png");
$sql_host = "127.0.0.1";
$sql_user = "";
$sql_pass = "";
$sql_db = "";
$sql_user = "root";
$sql_pass = "starfox";
$sql_db = "site";
$font = "./verdana.ttf";
$y_start = 0;
$fsize = 8;
$max_width = 400;
//Open connection for post count
$link = mysql_connect($sql_host, $sql_user, $sql_pass)
or die("Could not connect : " . mysql_error());
mysql_select_db($sql_db,$link)
or die("Could not select database");
//If the table doesnt exist, create it
$query = "CREATE TABLE IF NOT EXISTS `ip_log` (`id` INT(11) NOT NULL auto_increment, `ipaddress` VARCHAR(64) NOT NULL, `count` INT(11) NOT NULL, PRIMARY KEY (`id`)) TYPE=MyISAM;";
mysql_query($query,$link);
$ip = $_SERVER['REMOTE_ADDR'];
//Get random quote
$quotes_array = file("./quotes.txt");
$quote = array_rand($quotes_array);
if ($quotes_array[$quote] == "IP_ADDR") {
$quotes_array[$quote] = "Hi ".$ip;
}
//Get IP count
$res = mysql_query("SELECT * FROM `ip_log` WHERE ipaddress='".$ip."'",$link);
if (mysql_num_rows($res) == 0) {
mysql_query("INSERT INTO `ip_log` VALUES ('','".$ip."',1)",$link);
$count = 1;
} else {
$row = mysql_fetch_row($res);
$count = (int)$row[2];
$count++;
$id = $row[0];
$query = "UPDATE `ip_log` SET count='".$count."' WHERE id='".$id."'";
mysql_query($query,$link);
mysql_free_result($res);
}
$text = "You have read ".$count." of my posts";
//----------------------------------------------------------------------
// Image Generation
//----------------------------------------------------------------------
//imagettfbbox ( float size, float angle, string fontfile, string text)
// 6,7-----------------4,5
// | |
// 0,1-----------------2,3
//imagefilledrectangle (image, int x1, int y1, int x2, int y2, int color)
//imagettftext (image, float size, float angle, int x, int y, int color, string fontfile, string text)
//$im = imagecreate($width, $height);
$quotes_array[$quote] = wordwrap($quotes_array[$quote],65,"\n");
$im = imagecreatefrompng("sig_img.png");
//$bg = imagecolorallocatealpha($im, 255, 255, 255, 127);
$fg = imagecolorresolve($im, 0, 0, 0);
imagettftext($im, $fsize, 0.0, 33, 15, $fg, $font, $quotes_array[$quote]);
imagettftext($im, $fsize, 0.0, 200, 48, $fg, $font, $text);
imagepng($im);
imagedestroy($im);
?>
-
Done.
Updated image in top post.
-
You forgot to click upload, I think
-
You can't prove that.
-
Thanks, that looks very good :)
-
Today I have read two of your posts. Yesterday it was three, and a little while back it said nine. Your code-fu is weak, grasshopper.
Edit: And right after I made this post, your sig broke. GG. :p
-
lolfighter, same for me. Except it's been 1 post forever. Don't know if Firefox is doing it or what. At least it's transparent?
EDIT: Wait no, it just went to 2! :p
-
I suspect firefox is blocking the referrer header, but I haven't really tested it though
-
The sig is working fine for me, and I use FireFox. I'm at 4. Before you reset it (before you had the image) I was up to 20 something
-
The sig is down to 1 now for me. Looks like it's counting backwards. XD
-
i'm at 12 now though before i was at 25 or so
anyways it looks great
-
I'm at 3, guess it is cause i always use Back on ze brovzer.
-
Eet's gawn :(
BRING IT BACK!
It was working properly for me. Maybe it's because I never use the back button :p
-
I never got rid of it.. I think my host had some dns problems in the last few days
-
worked fine in ff, stuck at 1 in ie (different comp)
bm <3's your quotes list thing
edit: nevermind, ie's f5 doesn't bypass cache. works fine in ie and ff
-
It should not be cached at all
There are 3 headers in the image that *should* prevent it from ever being cached :)
-
unless the school systems are just that fast, it was drawn almost as fast as the text (which implies a cached image) on f5. also, the counter does not increase on f5 in ie (works fine on reply and topic --> parent --> topic)