Jump to content

Php draw image...


kevincon

Recommended Posts

For some reason this doesn't work.

 

It doesn't show up as an image, except when i save it to the desktop it shows the image...

 

<?php
require("config.php");
				if(isset($_GET['p'])) 
				{ 
					$Id = $_GET['p']; 
					$Id = mysql_real_escape_string($Id);


							$steam = mysql_query("SELECT * FROM users WHERE ID='$Id'") or die ("Error in query".mysql_error());
							if (mysql_num_rows($steam) > 0) 
							{
								while($row = mysql_fetch_array($steam)) 
								{
									$username = $row["username"];
									$money = $row["money"];
								}
							}
$text = $username."    Money: ".$money."     ClanNV.com";

$my_img = imagecreate( 450, 25 );
$background = imagecolorallocate( $my_img, 0, 0, 0 );
$text_colour = imagecolorallocate( $my_img, 255, 255, 255 );
imagestring( $my_img, 3, 100, 8, $text ,$text_colour );
imagesetthickness ( $my_img, 5 );


header( "Content-type: image/jpeg" );
imagejpeg( $my_img );
imagecolordeallocate( $text_color );
imagecolordeallocate( $background );
imagedestroy( $my_img );
}else{
$my_img = imagecreate( 450, 25 );
$background = imagecolorallocate( $my_img, 0, 0, 0 );
$text_colour = imagecolorallocate( $my_img, 255, 255, 255 );
imagestring( $my_img, 3, 200, 8, "No user defined",$text_colour );
imagesetthickness ( $my_img, 5 );


header( "Content-type: image/jpeg" );
imagejpeg( $my_img );
imagecolordeallocate( $text_color );
imagecolordeallocate( $background );
imagedestroy( $my_img );
}
?>

 

Help?

 

 

 

Also how can i write text over a jpeg

I can't seem to get it...

 

I used imagecreatefromjpeg.

Link to comment
https://forums.phpfreaks.com/topic/163818-php-draw-image/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.