Forum Topic: php: gd

(127 views • 4 replies)

This topic is 1 page long.

<< < > >>
None

dburford11

Reply To Post Reply & Quote

Posted at: 5/3/09 09:43 PM

dburford11 NEUTRAL LEVEL 03

Sign-Up: 04/01/05

Posts: 412

I'm trying to make an image from 2 images. But when I use the script, it shows up as a pure black image. Can anyone tell me the error?

<?
include $_SERVER['DOCUMENT_ROOT']."/includes/db.connect.php";
	
	$id = $_GET['id'];
	
	$result = mysql_query("SELECT * FROM `user_data` WHERE `id` = '".$id."' LIMIT 1");
	while( $row = mysql_fetch_array( $result ) )
	{
	
		$query = mysql_query("SELECT * FROM `sub_main` WHERE `user_name` = '".$row['name']."' LIMIT 1");
		while( $wor = mysql_fetch_array( $query ) )
		{
	
	
		$bg_src = $_SERVER['DOCUMENT_ROOT']."/subrosian/images/square/basic.png";
		$top_src = $_SERVER['DOCUMENT_ROOT']."/subrosian/images/square/top.png";
		$bg = imagecreatefrompng( $bg_src );
		$top = imagecreatefrompng( $top_src );
		$font_color = imagecolorallocate( $bg, 237, 243, 74 );
		$im = imagecreatetruecolor( 90, 90 );
		
		imagerectangle( $im, 0, 0, 60, 60, $top );
		imagefilledrectangle( $im, 0, 0, 90, 90, $bg );

		
		
		header("Content-type: image/png");
		
		imagepng( $im );
		
		imagedestroy( $im );
		
		
	
	}
	
}
?>

The Universe in a Billion Years - A fictional history of the universe from the future


None

dburford11

Reply To Post Reply & Quote

Posted at: 5/3/09 09:49 PM

dburford11 NEUTRAL LEVEL 03

Sign-Up: 04/01/05

Posts: 412

<?
include $_SERVER['DOCUMENT_ROOT']."/includes/db.
connect.php";

$id = $_GET['id'];

$result = mysql_query("SELECT * FROM `user_data` WHERE `id` = '".$id."' LIMIT 1");
while( $row = mysql_fetch_array( $result ) )
{

$query = mysql_query("SELECT * FROM `sub_main` WHERE `user_name` = '".$row['name']."' LIMIT 1");
while( $wor = mysql_fetch_array( $query ) )
{

$bg_src = $_SERVER['DOCUMENT_ROOT']."/subrosian/im ages/square/basic.png";
$top_src = $_SERVER['DOCUMENT_ROOT']."/subrosian/im ages/square/top.png";
$bg = imagecreatefrompng( $bg_src );
$top = imagecreatefrompng( $top_src );
$font_color = imagecolorallocate( $bg, 237, 243, 74 );
$im = imagecreatetruecolor( 90, 90 );

imagerectangle( $im, 0, 0, 60, 60, $top );
imagerectangle( $im, 0, 0, 90, 90, $bg );

header("Content-type: image/png");

imagepng( $im );

imagedestroy( $im );

}

}
?>

i changed the imagefilledrectangle to imagerectangle and it still is filled black

The Universe in a Billion Years - A fictional history of the universe from the future


None

DearonElensar

Reply To Post Reply & Quote

Posted at: 5/4/09 12:02 AM

DearonElensar LIGHT LEVEL 18

Sign-Up: 06/10/02

Posts: 1,731

Are you sure PHP finds the images? Trying echo'ing them with a <ing> or something.

BBS Signature

None

WoogieNoogie

Reply To Post Reply & Quote

Posted at: 5/4/09 01:22 AM

WoogieNoogie LIGHT LEVEL 14

Sign-Up: 06/26/05

Posts: 3,284

Does your host have the GD Library installed?


None

dburford11

Reply To Post Reply & Quote

Posted at: 5/4/09 03:20 PM

dburford11 NEUTRAL LEVEL 03

Sign-Up: 04/01/05

Posts: 412

yes, because I use GD on a number of things on the website. But any other time it doesn't find the image, it just gives me an error

The Universe in a Billion Years - A fictional history of the universe from the future


All times are Eastern Standard Time (GMT -5) | Current Time: 05:55 PM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!