GD library

Status
Not open for further replies.

jake04

New Member
Messages
52
Reaction score
0
Points
0
does x10 have the GD library installed?


having so php problems with my scripts
 

YamiKaitou

Member
Messages
636
Reaction score
0
Points
16
Yes, the GD library is installed. What are the errors that you are incountering?
 

jake04

New Member
Messages
52
Reaction score
0
Points
0
Code:
//signature
/*
http://yoururl.com/game.php?act=sig&user=username
*/
function sig() {
	header("Content-type: image/gif"); //this lines tells the browers that the PHP file is a PNG image
	$user = $_GET["user"]; //username to display on the signature
	$img = imagecreatefrompng("image.gif");
	$black = imagecolorallocate($img,0,0,0); //makes the background color black
	$lime = imagecolorallocate($img,50,205,50); //the color white (used for text)
	//if you want to change the text or backgroud color then re-enter the RGB values
	imagestring($img,1,1,0,"Chao Online",$lime); //draws the text "Name of your game" (the first number is the size of the text, the second is the x position of the text, the third is the y position of the text)
	$statsq = mysql_query("SELECT * FROM users WHERE username='$user'") or die("ERROR"); //mysql query to get * (meaning anyting) from the table where the username is $user
	while ($stats = mysql_fetch_assoc($statsq)) {
  		imagestring($img,1,1,10,"Username: $stats[username]",$lime); //draws the players username
		imagestring($img,1,1,20,"Score: $stats[score]",$lime); //draws the players score	
if ($stats[online]) {
	imagestring($img,1,1,30,"Status: Online",$lime);
} else {
	imagestring($img,1,1,30,"Status: Offline",$lime);
}
	}
	imagegif($img); //draws the whole image as a PNG
	imagedestroy($img); //destroys the whole image
}
doesn't work and a php expert said no GD libarary
Edit:
http://starlg.com/polygon/test.php?act=sig&user=Fox_USA
see and the image name is image.gif
Edit:
got it to work nvm
Edit:
is there a way to save the image that was just created to a file?
 
Last edited:

YamiKaitou

Member
Messages
636
Reaction score
0
Points
16
Okay, in that case than, try this. I can't try it cause I am on a different server than you are

Create a new file named gdinfo.php (or whatever you want)

Make it contain this info
PHP:
<?php
var_dump(gd_info());
?>

Upload the file to your hosting.

Display the page it displays when you go to the page here.
 

Bryon

I Fix Things
Messages
8,149
Reaction score
101
Points
48
You would use mod_rewrite to 'mask' the 'real' filename/URL of the script. I'm not going to go into detail much about that though. Search Google for it or wait for someone else to post more about it if you want to know more. (I suck at regular expressions)

is there a way to save the image that was just created to a file?

Yes, using a PHP function such as imagegif(), imagejpeg(), imagepng(), etc. With the second parameter you can specify a filename/path to save the image to.
 

jake04

New Member
Messages
52
Reaction score
0
Points
0
this is a script to interact with a game
so a lot of people use it
so i cant rewrite the file
 

Cubeform

New Member
Messages
339
Reaction score
0
Points
0
this is a script to interact with a game
so a lot of people use it
so i cant rewrite the file

mod_rewrite doesn't rewrite anything in your file; all it does is create an "alias" of a URL to your file, kind of like shortcuts in Windows. Your old URL will still work after you implement mod_rewrite rules.
 
Last edited:

jake04

New Member
Messages
52
Reaction score
0
Points
0
but will it be live?
Edit:
it is and working thaks a lot for every one that helped
you will be in the credits of my game
 
Last edited:
Status
Not open for further replies.
Top