MasterACE14 Posted May 10, 2008 Share Posted May 10, 2008 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 More sharing options...
jonsjava Posted May 10, 2008 Share Posted May 10, 2008 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. Link to comment https://forums.phpfreaks.com/topic/104970-dynamic-signature-generator/#findComment-537331 Share on other sites More sharing options...
MasterACE14 Posted May 10, 2008 Author Share Posted May 10, 2008 yeah I know that, but the strange thing is. When I link to the image with all the GETs in the URL, like on a forum, the image works fine. minus the CSS properties. But if I go to the image directly, I get errors. Link to comment https://forums.phpfreaks.com/topic/104970-dynamic-signature-generator/#findComment-537351 Share on other sites More sharing options...
jonsjava Posted May 10, 2008 Share Posted May 10, 2008 you mean this: <img src="image.php?get=1"> that's because you aren't outputting it the same way. the HTML is calling it, not the server-side script. Link to comment https://forums.phpfreaks.com/topic/104970-dynamic-signature-generator/#findComment-537358 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.