Jump to content

Image Generation, imagecopymerge,imagettftext


Dusaro

Recommended Posts

Well, I have been tryna figure this out for days but it wont seem to work. The base image appears fine but it wont write the text or the avatar on it.

 

<?php

//Do Not Cache
header("Cache-Control: no-store, no-cache, must-revalidate"); 
header("Cache-Control: post-check=0, pre-check=0", false); 
header("Pragma: no-cache");

//Getting Variables
$user = "Dusaro";
$rank = "Administrator";
$a = "0";

if(isset($_GET['a']))
{
if(!empty($_GET['a']))
{
	$a = $_GET['a'];
}
}

if(isset($_GET['u']))
{
if(!empty($_GET['u']))
{
	$user = $_GET['u'];
}
}

if(isset($_GET['r']))
{
if(!empty($_GET['r']))
{
	$rnk = $_GET['r'];
}
else{$rnk='Administrator';}
}
else{$rnk='Administrator';}

if(isset($_POST['u'],$_POST['r'],$_POST['a']))
{
if(!empty($_POST['u']))
{
	$user=$_POST['u'];
}
if(!empty($_POST['r']))
{
	$rnk = $_POST['r'];
}
if(!empty($_POST['a']))
{
	$a = $_POST['a'];
}
}


//Setting up Image
$image = imagecreatefrompng("base.png");
$avatar = imagecreatefrompng($a.".png");
$font = "US101.TTF";

imagecopymerge($image, $avatar, 0, 0, 0, 0, 100, 100, 100);
$color = imagecolorallocate($image, 0,0,0);
ImageTTFText ($image, "15", 0, 230, 0, $color, $font,$user);
ImageTTFText ($image, "14", 0, 257, 96, $color,$font,$rnk);

//Displaying Image
header("Content-type: image/png");
imagepng($image);
imagedestroy($image);
imagedestroy($avatar);

?>

 

can any1 help?

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.