Jump to content

Dynamic Signature Generator


MasterACE14

Recommended Posts

hey,

 

I am working on making a dynamic signature generator for my text game but I'm having trouble with the image file.

 

Editing the image with CSS appears to be working fine. But displaying the image isn't working.

 

here's the image file:

<?php
session_start();
ob_start();

error_reporting(E_ALL);

?>

<style type="text/css">
<!--

#signature-text
{
width: 400px;
height: 100px;
border: 1px <?php echo $_GET['border_style']; ?> <?php echo $_GET['border_color']; ?>;
background-image: url('http://www.crikeygames.com.au/conflictingforces/signature/cf_sig.png');
background-repeat: no-repeat;
margin-left: auto;
margin-right: auto;
}

-->
</style>

<?php

$image = "http://www.crikeygames.com.au/conflictingforces/signature/cf_sig.png";  
$im = imagecreatefrompng($image); 
$wc = ImageColorAllocate ($im, 255, 255, 255);  
$red = ImageColorAllocate ($im, 255, 0, 0); 
ImageString($im, 3, 260, 15, $_GET['player'], $wc);  
header("Content-Type: image/png");  
Imagepng($im,'',100);  
ImageDestroy ($im); 

ob_end_flush();

?>

 

I'm getting this message:

The image “http://crikeygames.com.au/conflictingforces/signature/cf_sig.php” cannot be displayed, because it contains errors.

 

and this is in the error_log file:

[09-May-2008 21:38:47] PHP Warning:  Cannot modify header information - headers already sent by (output started at /home/ace/public_html/conflictingforces/signature/cf_sig.php:1) in /home/ace/public_html/conflictingforces/signature/cf_sig.php on line 34

[09-May-2008 21:39:08] PHP Warning:  Cannot modify header information - headers already sent by (output started at /home/ace/public_html/conflictingforces/signature/cf_sig.php:1) in /home/ace/public_html/conflictingforces/signature/cf_sig.php on line 34

[09-May-2008 21:43:00] PHP Warning:  Cannot modify header information - headers already sent by (output started at /home/ace/public_html/conflictingforces/signature/cf_sig.php:1) in /home/ace/public_html/conflictingforces/signature/cf_sig.php on line 32

[09-May-2008 21:49:04] PHP Warning:  Cannot modify header information - headers already sent by (output started at /home/ace/public_html/conflictingforces/signature/cf_sig.php:1) in /home/ace/public_html/conflictingforces/signature/cf_sig.php on line 32

[09-May-2008 21:50:12] PHP Warning:  Cannot modify header information - headers already sent by (output started at /home/ace/public_html/conflictingforces/signature/cf_sig.php:1) in /home/ace/public_html/conflictingforces/signature/cf_sig.php on line 32

[09-May-2008 21:51:09] PHP Warning:  Cannot modify header information - headers already sent by (output started at /home/ace/public_html/conflictingforces/signature/cf_sig.php:1) in /home/ace/public_html/conflictingforces/signature/cf_sig.php on line 32

[09-May-2008 21:53:09] PHP Notice:  Undefined index:  border_style in /home/ace/public_html/conflictingforces/signature/cf_sig.php on line 16

[09-May-2008 21:53:09] PHP Notice:  Undefined index:  border_color in /home/ace/public_html/conflictingforces/signature/cf_sig.php on line 16

[09-May-2008 21:53:09] PHP Notice:  Undefined variable:  sitename in /home/ace/public_html/conflictingforces/signature/cf_sig.php on line 32

[09-May-2008 21:53:09] PHP Notice:  Undefined variable:  who_online in /home/ace/public_html/conflictingforces/signature/cf_sig.php on line 33

[09-May-2008 21:53:09] PHP Notice:  Undefined variable:  userCount in /home/ace/public_html/conflictingforces/signature/cf_sig.php on line 34

[09-May-2008 22:08:33] PHP Notice:  Undefined index:  border_style in /home/ace/public_html/conflictingforces/signature/cf_sig.php on line 16

[09-May-2008 22:08:33] PHP Notice:  Undefined index:  border_color in /home/ace/public_html/conflictingforces/signature/cf_sig.php on line 16

[09-May-2008 22:08:33] PHP Notice:  Undefined variable:  sitename in /home/ace/public_html/conflictingforces/signature/cf_sig.php on line 32

[09-May-2008 22:08:33] PHP Notice:  Undefined variable:  who_online in /home/ace/public_html/conflictingforces/signature/cf_sig.php on line 33

[09-May-2008 22:08:33] PHP Notice:  Undefined variable:  userCount in /home/ace/public_html/conflictingforces/signature/cf_sig.php on line 34

 

EDIT: fixed undefined border_color and border_style

 

any help is greatly appreciated.

 

Regards ACE

Link to comment
https://forums.phpfreaks.com/topic/104970-dynamic-signature-generator/
Share on other sites

you're trying to output headers:

<?php

$image = "http://www.crikeygames.com.au/conflictingforces/signature/cf_sig.png";  
$im = imagecreatefrompng($image); 
$wc = ImageColorAllocate ($im, 255, 255, 255);  
$red = ImageColorAllocate ($im, 255, 0, 0); 
ImageString($im, 3, 260, 15, $_GET['player'], $wc);  
header("Content-Type: image/png");  
Imagepng($im,'',100);  
ImageDestroy ($im); 

ob_end_flush();

after outputting something to the screen:

<style type="text/css">
<!--

#signature-text
{
width: 400px;
height: 100px;
border: 1px <?php echo $_GET['border_style']; ?> <?php echo $_GET['border_color']; ?>;
background-image: url('http://www.crikeygames.com.au/conflictingforces/signature/cf_sig.png');
background-repeat: no-repeat;
margin-left: auto;
margin-right: auto;
}

-->
</style>

you can't do that. you must output a header before anything else.

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.