Jump to content

gd text color negating


bftwofreak

Recommended Posts

Hey guys, I'm new to gd and I was wondering, but as soon as I implemented the Emblem image overlay, the color of the text disappeared. Can anyone tell me what happened? and what I can do to fix/prevent this?

<?php

define(BUNGIE, 'http://www.bungie.net');

include('dom.php');

if (isset($_GET['tag'])){
$tag = str_replace('%20','+',$_GET['tag']);
$tag = str_replace(' ','+',$tag);
$ptag = str_replace('%20', ' ', $_GET['tag']);
$ptag = str_replace('+', ' ', $ptag);

$dom = file_get_dom('http://www.bungie.net/Stats/Halo3/Default.aspx?player=' . $tag);

if ($dom->find('h1', 0)->innertext != 'Halo 3 Service Record Not Found') {
//Required
header('Content-type: image/gif');
mkdir($tag);
//image create
$end = imagecreate(450, 150)
 or die('Cannot Initialize new GD image stream');

//Background
$background_color = imagecolorallocate($end, 0, 0, 0);

//Rank
$rank = @imagecreatefromgif(BUNGIE . $dom->getElementById('ctl00_mainContent_identityStrip_imgRank')->src);
imagegif($rank, $tag . '/rank.gif');
imagedestroy($rank);

//Snapshot
$snapt = BUNGIE . $dom->getElementById('ctl00_mainContent_imgModel')->src;
$snapt = str_replace('&','&',$snapt);
$snap = imagecreatefromjpeg($snapt);
imagegif($snap, $tag . '/snapshot.gif');
imagedestroy($snap);
$snap = imagecreatefromgif($tag . '/snapshot.gif');
imagecopyresized($end,$snap,5,20,0,0,125,125,imagesx($snap),imagesy($snap));

//Emblem
$emblemt = BUNGIE . $dom->getElementById('ctl00_mainContent_identityStrip_EmblemCtrl_imgEmblem')->src;
$emblemt = str_replace('&','&',$emblemt);
$emblem = imagecreatefromjpeg($emblemt);
imagegif($emblem, $tag . '/emblem.gif');
imagedestroy($emblem);
$emblem = imagecreatefromgif($tag . '/emblem.gif');
imagecopy($end,$emblem,135,20,0,0,imagesx($emblem),imagesy($emblem));

//Gamertag and Service Tag
$stag = $dom->getElementById('ctl00_mainContent_identityStrip_lblServiceTag')->innertext;
$gt_color = imagecolorallocate($end, 233, 0, 0);
imagestring($end, 3, 5, 5, $ptag . ' - ' . $stag, $gt_color);

//image produce

imagegif($end, $tag . '/sig.gif');
imagedestroy($snap);
imagedestroy($end);
header('Content-type: text/html');
echo '<img src="http://sig.halo3.updominon.com/' . $tag . '/sig.gif" />';
} else {
echo 'Your Service Record was not Found<br />
<form action="?" method="get" enctype="text/plain">
Insert Gamertag<input type="text" name="tag" />
<input type="submit" value="Submit" />
</form>';
}
} else {
echo '<form action="?" method="get" enctype="text/plain">
Insert Gamertag<input type="text" name="tag" />
<input type="submit" value="Submit" />
</form>';
}

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.