...

View Full Version : header error while inputting php in html



digi duck
06-21-2006, 05:05 PM
hi everyone, i have a problem where i want to show some php script in a html file but everytime i do it it comes up with this error.


Warning: Cannot modify header information - headers already sent by (output started at /home/www/gamesigs.co.uk/_sig_created.php:6) in /home/www/gamesigs.co.uk/_sig_created.php on line 225


This is diplayed where i want it to be on the html page but no image is created as it should do.

This is line 225


header("Content-type: image/jpeg");

This is the code for all of my page


<html>
<head>
<title>Game Sigs</title>
<META name="description" content="Create your own unique signature from a range of images for use in forums, emails, blogs and websites!">
<META name="keywords" content="signature, game, games, create, create a signature, draw a signature, make a signature, generate a sig, make a sig, create a sig.">
<style type="text/css">
</style>
</head>

<body bgcolor="#666666" text="#000000" link="#0000FF" vlink="#000000" alink="#000000">
<table width="975" border="0" cellpadding="0" cellspacing="0" bgcolor="#666666">
<!--DWLayoutTable-->
<tr>
<td width="113" height="10"></td>
<td width="9" rowspan="33" valign="top" bgcolor="#F4F4F4"><img src="left_side.gif" width="9" height="1177"></td>
<td colspan="11" valign="top" bgcolor="#F4F4F4"><img src="bar.gif" width="720" height="10"></td>
<td width="9" rowspan="33" valign="top" bgcolor="#F4F4F4"><img src="right_side.gif" width="9" height="1177"></td>
<td width="124"></td>
</tr>
<tr>
<td height="125">&nbsp;</td>
<td colspan="11" valign="middle" bgcolor="#FFFFFF"><div align="center"><font size="7" face="Comic Sans MS">Gamesigs.co.uk</font></div></td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="19">&nbsp;</td>
<td colspan="7" valign="middle" bgcolor="#FFFFFF"> <a href="http://gamesigs.awardspace.com/invite.php"><img src="msn.jpeg" alt="Invite a Friend" height="19" border="0"></a>
<img src="star.jpeg" onClick="window.external.AddFavorite(location.href, document.title);" alt="Add to Favoutites" width="18" height="18">
<img src="homepage.gif" alt="Make Homepage" width="19" height="19" onClick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://gamesigs.awardspace.com');" a href="#"></td>
<td colspan="4" valign="top" bgcolor="#FFFFFF"><div align="right">
<!-- #BeginDate format:fcAm1a -->Wednesday, June 21, 2006 3:47 PM<!-- #EndDate -->
</div></td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="10"></td>
<td colspan="11" valign="top" bgcolor="#F4F4F4"><div align="center"><img src="bar.gif" width="720" height="10">
</div></td>
<td></td>
</tr>
<tr>
<td height="5"></td>
<td colspan="5" rowspan="3" align="center" valign="middle" bgcolor="#FFFFFF">
<div align="center"><a href="http://gamesigs.awardspace.com" style="text-decoration:none; color:black".><strong><font color="#000000" face="Comic Sans MS">Home</font></strong></a><font color="#000000" face="Comic Sans MS">
<strong><a href="http://gamesigs.co.uk/choosegame.php" style="text-decoration:none; color:black".>Create</a>
<a href="http://gamesigs.awardspace.com/demo.php"style="text-decoration:none; color:black". >Demo</a>
<a href="http://gamesigs.co.uk/phpBB2"style="text-decoration:none; color:black". >Forum</a>
<a href="http://gamesigs.co.uk/phpBB2/viewforum.php?f=12"style="text-decoration:none; color:black". >Request</a>
<a href="http://gamesigs.co.uk/phpBB2/viewforum.php?f=11"style="text-decoration:none; color:black". >Upload</a>
<a href="http://gamesigs.awardspace.com/contact.php"style="text-decoration:none; color:black". >Contact</a></strong></font>
</div></td>
<td colspan="6" valign="top"><img src="marqueefill.jpg" width="322" height="5"></td>
<td></td>
</tr>
<tr>
<td height="28"></td>
<td width="28" valign="top"><p><font color="#FFFFFF"><img src="leftmarquee%20copy.jpg" width="28" height="28"></font></p></td>
<td colspan="4" align="center" valign="middle" bgcolor="#000000"> <marquee>
<font color="#FFFFFF" size="2">Gamesigs.co.uk - Beat the best, Destroy the
rest</font><font color="#FFFFFF" size="2" face="Comic Sans MS"> </font>
</marquee></td>
<td width="28" valign="top"><img src="rightmarquee.jpg" width="28" height="28"></td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="5"></td>
<td colspan="6" valign="top"><img src="marqueefill.jpg" width="322" height="5"></td>
<td></td>
</tr>
<tr>
<td height="10"></td>
<td colspan="11" valign="top"><img src="bar.gif" width="720" height="10"></td>
<td></td>
</tr>
<tr>
<td height="49"></td>
<td width="120" rowspan="7" valign="top" bgcolor="#FFFFFF"> <script type="text/javascript"><!--
google_ad_client = "pub-2256213448175782";
google_ad_width = 120;
google_ad_height = 240;
google_ad_format = "120x240_as";
google_ad_type = "text";
google_ad_channel ="";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "000000";
google_color_text = "666666";
google_color_url = "666666";
//--></script> <script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script> </td>
<td width="22" rowspan="23" valign="top" bgcolor="#CCCCCC"><!--DWLayoutEmptyCell-->&nbsp;</td>
<td colspan="9" valign="top" bgcolor="#FFFFFF"> <form method="get" action="http://www.google.com/custom" target="_top">
<table border="0" bgcolor="#ffffff">
<!--DWLayoutTable-->
<tr>
<td width="572" height="45" align="left" valign="top" nowrap="nowrap" bgcolor="#CCCCCC">
<div align="center"><font size="2">Page loaded in</font>
<?php
$load = microtime();
print (number_format($load,2));
?> <font size="1"> <font size="2">seconds</font></font><font size="2">.</font>
<!-- SiteSearch Google -->
<input type="hidden" name="domains" value="gamesigs.co.uk">
<input type="hidden" name="client" value="pub-2256213448175782">
<input type="hidden" name="forid" value="1">
<input type="hidden" name="ie" value="ISO-8859-1">
<!-- SiteSearch Google -->
<input type="radio" name="sitesearch" value="" checked="checked">
<font color="black" size="-1" face="Comic Sans MS">Web</font><font size="-1" color="black">
<input type="radio" name="sitesearch" value="gamesigs.co.uk">
<font face="Comic Sans MS">Gamesigs</font> </font>
<input type="text" name="q" size="25" maxlength="255" value="">
<input type="submit" name="sa" value="Search">
<input type="hidden" name="oe" value="ISO-8859-1">
<input type="hidden" name="hl" value="en">
<input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000FF;T:000 000;GFNT:0000FF;GIMP:0000FF;FORID:1;">
</div></td>
</tr>
</table>
</form></td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="25">&nbsp;</td>
<td width="54" rowspan="22" valign="top" bgcolor="#FFFFFF"><!--DWLayoutEmptyCell-->&nbsp;</td>
<td width="10" rowspan="2" valign="top" bgcolor="#CCCCCC"><img src="left_side.gif" width="10" height="145"></td>
<td colspan="4" align="center" valign="middle" bgcolor="#CCCCCC"> <div align="center"><strong></strong></div></td>
<td width="10" rowspan="2" valign="top" bgcolor="#CCCCCC"><img src="right_side.gif" width="10" height="145"></td>
<td colspan="2" rowspan="22" valign="top" bgcolor="#FFFFFF"><!--DWLayoutEmptyCell-->&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="120">&nbsp;</td>
<td colspan="4" valign="top" bgcolor="#F4F4F4"><div align="center">


//////////////////////////////////////////////////////////////////
/////////This is the important part ////////////////////////////
////////////////////////////////////////////////////////////////////
<?
$name = stripslashes($_GET['name']);
$size = stripslashes($_GET['size']);
$font = 'images/sig_maker/fonts/'.stripslashes($_GET['font']).'.ttf';
$fontcolor['r'] = stripslashes($_GET['color_r']); // font color - RED
$fontcolor['g'] = stripslashes($_GET['color_g']); // font color - GREEN
$fontcolor['b'] = stripslashes($_GET['color_b']); // font color - BLUE
$shadow = stripslashes($_GET['shadow']);
$lines = stripslashes($_GET['lines']);
function arrow($im, $x1, $y1, $x2, $y2, $alength, $awidth, $color){
///
}
switch ($_GET['color']) {
case '1':
$bgpic = 'images/sig_maker/1.jpeg';
break;
case '2':
$bgpic = 'images/sig_maker/2.jpeg';
break;
case '3':
$bgpic = 'images/sig_maker/3.jpeg';
break;
case '4':
$bgpic = 'images/sig_maker/4.jpeg';
break;
case '5':
$bgpic = 'images/sig_maker/5.jpeg';
break;
case '6':
$bgpic = 'images/sig_maker/6.gif';
break;
case '7':
$bgpic = 'images/sig_maker/7.gif';
break;
case '8':
$bgpic = 'images/sig_maker/8.gif';
break;
case 'random':
$num = mt_rand(1,5);
if($num == 1){ $bgpic = 'images/sig_maker/1.jpeg'; }
elseif($num == 2){ $bgpic = 'images/sig_maker/2.jpeg'; }
elseif($num == 3){ $bgpic = 'images/sig_maker/3.jpeg'; }
elseif($num == 4){ $bgpic = 'images/sig_maker/4.jpeg'; }
elseif($num == 5){ $bgpic = 'images/sig_maker/5.jpeg'; }
break;
default:
$num = mt_rand(1,5);
if($num == 1){ $bgpic = 'images/sig_maker/1.jpeg'; }
elseif($num == 2){ $bgpic = 'images/sig_maker/2.jpeg'; }
elseif($num == 3){ $bgpic = 'images/sig_maker/3.jpeg'; }
elseif($num == 4){ $bgpic = 'images/sig_maker/4.jpeg'; }
elseif($num == 5){ $bgpic = 'images/sig_maker/5.jpeg'; }
}


$im = imagecreatefromjpeg($bgpic);
//Calculate, the centre:
for(;;){
list($image_width, $image_height) = getimagesize($bgpic);
list($left_x, , $right_x) = imagettfbbox($size, 0, $font, $name);
$text_width = $right_x - $left_x;
if($image_width > $text_width+5){
break;
}
$size = $size - .5;
if($size == 1){
die('Script not responding to decreasing font size, in other words: try using less letters.');
}
}
$padding = ($image_width - $text_width)/2;

$textcolor = imagecolorresolve($im, $fontcolor['r'], $fontcolor['g'], $fontcolor['b']);

$grey = imagecolorallocate($im, 128, 128, 128);

if($shadow == 'y'){
imagettftext($im, $size, 0, $padding+1, 77, $grey, $font, $name);
}
if($lines == 'y'){

//imagettftext($im, $size, 0, $padding+1, 77, $grey, $font, $name);

}

imagettftext($im, $size, 0, $padding, 75, $textcolor, $font, $name);
if($_GET['dl']){
header('Content-Disposition: attachment; filename="sig.jpeg"');
}
header("Content-type: image/jpeg");
imagegif($im);
?>


//////////////////////////////////////////////////////////



</div></td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="10"></td>
<td colspan="6" valign="top" bgcolor="#CCCCCC"><img src="bar.gif" width="470" height="10"></td>
<td></td>
</tr>
<tr>
<td height="19"></td>
<td colspan="6" valign="top" bgcolor="#FFFFFF"><!--DWLayoutEmptyCell-->&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="25"></td>
<td rowspan="3" valign="top" bgcolor="#CCCCCC"><img src="left_side.gif" width="10" height="145"></td>
<td colspan="4" valign="middle" bgcolor="CCCCCC"> <div align="center"><strong></strong></div></td>
<td rowspan="3" valign="top" bgcolor="#CCCCCC"><img src="right_side.gif" width="10" height="145"></td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="84"></td>
<td colspan="4" rowspan="2" valign="middle" bgcolor="#F4F4F4"><!--DWLayoutEmptyCell-->&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="36"></td>
<td rowspan="15" valign="top" bgcolor="#FFFFFF"><script type="text/javascript"><!--
google_ad_client = "pub-2256213448175782";
google_ad_width = 120;
google_ad_height = 600;
google_ad_format = "120x600_as";
google_ad_type = "text_image";
google_ad_channel ="";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "000000";
google_color_text = "666666";
google_color_url = "666666";
//--></script> <script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="10"></td>
<td colspan="6" valign="top" bgcolor="#CCCCCC"><img src="bar.gif" width="470" height="10"></td>
<td></td>
</tr>
<tr>
<td height="19"></td>
<td colspan="6" valign="top" bgcolor="#FFFFFF"><!--DWLayoutEmptyCell-->&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="25"></td>
<td rowspan="2" valign="top"><img src="left_side.gif" width="10" height="145"></td>
<td colspan="4" valign="middle" bgcolor="#CCCCCC"> <div align="center"><strong></strong></div></td>
<td rowspan="2" valign="top"><img src="right_side.gif" width="10" height="145"></td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="120"></td>
<td colspan="4" valign="top" bgcolor="#F4F4F4"><!--DWLayoutEmptyCell-->&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="10"></td>
<td colspan="6" valign="top"><img src="bar.gif" width="470" height="10"></td>
<td></td>
</tr>
<tr>
<td height="19"></td>
<td colspan="6" valign="top" bgcolor="#FFFFFF"><!--DWLayoutEmptyCell-->&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="25"></td>
<td rowspan="2" valign="top"><img src="left_side.gif" width="10" height="145"></td>
<td colspan="4" valign="middle" bgcolor="#CCCCCC"> <div align="center"><font face="Comic Sans MS"></font></div></td>
<td rowspan="2" valign="top"><img src="right_side.gif" width="10" height="145"></td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="120"></td>
<td colspan="4" valign="top" bgcolor="#F4F4F4"><div align="center">
<p>&nbsp;</p>
</div></td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="10"></td>
<td colspan="6" valign="top"><img src="bar.gif" width="470" height="10"></td>
<td></td>
</tr>
<tr>
<td height="19"></td>
<td colspan="6" valign="top" bgcolor="#FFFFFF"><!--DWLayoutEmptyCell-->&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="25"></td>
<td rowspan="2" valign="top"><img src="left_side.gif" width="10" height="159"></td>
<td colspan="4" valign="middle" bgcolor="#CCCCCC"> <div align="center"><strong></strong></div></td>
<td rowspan="2" valign="top"><img src="right_side.gif" width="9" height="159"></td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="134"></td>
<td colspan="4" valign="top" bgcolor="#F4F4F4"> <div align="center"></div></td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="10"></td>
<td colspan="6" valign="top"><img src="bar.gif" width="470" height="10"></td>
<td></td>
</tr>
<tr>
<td height="18"></td>
<td colspan="6" rowspan="2" valign="top" bgcolor="#FFFFFF"><div align="center"><strong>You
are visitor no.
<!-- Start of StatCounter Code -->
<script type="text/javascript" language="javascript">
<!--
var sc_project=1647783;
var sc_invisible=0;
var sc_partition=15;
var sc_security="057bec6d";
var sc_text=2;
//-->
</script>
<script type="text/javascript" language="javascript" src="http://www.statcounter.com/counter/counter.js"></script>
</strong> </div></td>
<td></td>

</tr>
<tr>
<td height="1"></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="22"></td>
<td colspan="2" valign="top" bgcolor="#CCCCCC"><!--DWLayoutEmptyCell-->&nbsp;</td>
<td colspan="9" valign="top" bgcolor="#CCCCCC"> <div align="center"> <font color="#000000">
<script type="text/javascript"><!--
google_ad_client = "pub-2256213448175782";
google_ad_output = "textlink";
google_ad_format = "ref_text";
google_cpa_choice = "CAAQ0KGL_QEaCAfnoShtwaohKPzWtIQB";
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</font></div></td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="10"></td>
<td colspan="11" valign="top"><img src="bar.gif" width="720" height="10"></td>
<td></td>
</tr>
<tr>
<td height="1"></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td width="192"></td>
<td></td>
<td width="49"></td>
<td width="181"></td>
<td></td>
<td width="26"></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
</body>
</html>




PLease help me. thanks

guelphdad
06-21-2006, 06:08 PM
Please don't post an entire script. post only the relevant error or a relevant piece of code.

The error means you have output some information to the screen prior to calling your header on line 225. You may not have any output sent before setting the headers.

digi duck
06-25-2006, 10:05 PM
where is this on the code?

digi duck
09-03-2006, 10:04 PM
*bump*

Mwnciau
09-03-2006, 10:26 PM
I don't think you can use header() after you've outputted some info..

digi duck
09-03-2006, 10:31 PM
so how can i solve this problem.

digi duck
01-02-2007, 12:11 PM
*bump* please help

koyama
01-02-2007, 01:35 PM
As guelphdad and Mwnciau say, you cannot write to HTTP headers after outputting HTML. This script was not made for embedding within HTML. It outputs the raw GIF image.


header("Content-type: image/jpeg");
imagegif($im);

Do you absolutely need to embed the image in a table? I'm quite sure the script would work if you place it in a file by itself.
Probably I'm just telling you what you know already...:D

digi duck
01-02-2007, 02:03 PM
i have it so the image comes up by itself on a new page. I want there to be information on this page as well as the image. So i would like it in a similar layout to the main page but with a photobucket upload image box there as well. I want this because people create there sig then dont know what to do with it. Some try hotlinking but my host doesnt allow it. I cant think of how to do it but every other site that lets users create images has it working so i know it can be done? PLease help

koyama
01-02-2007, 02:31 PM
Alright I see. With the risk of giving bad advice, here is what I suggest.

1. Create a new file only containing the script exactly as it is, and call it e.g. sign.gif.php (The last .php extension ensures that the file is parsed by the php engine). It will look like


<?php
$name = stripslashes($_GET['name']);
$size = stripslashes($_GET['size']);
...
header("Content-type: image/jpeg");
imagegif($im);
?>


2. Keep your original file as it is, but remove the script within the table cell, and instead put in an image tag linking to the script above that generates your raw gif appending the appropirate GET variables necessary to create the image. You will have something like


...
<td>
<img src="sign.gif.php?name=something&amp;size=100&amp;font=arial" />
</td>
...

Hope this will bring you on the right track.:)

digi duck
01-02-2007, 03:35 PM
sorry but this didnt work. It came up with the same errors i was getting before. Any more ideas how to show a php generated image on a html page without getting header errors?

CFMaBiSmAd
01-02-2007, 04:19 PM
The method that koyama has posted is how to make this work. A web page must have a valid <img src="a_url_that_results_in_an_image_being_output"... HTML tag where you want the image to appear.

If you are still getting the same error, the header(....) statement is probably still appearing in the code for your web page. Post your current code for the web page.

digi duck
01-04-2007, 04:56 PM
ok right I think i get you know. I have taught myself php so im not great so please explain things in detail and try not to laugh.

Ok heres what ive done (i probably done something really stupid)

I put this img src tag in

<img src="creation.php"?color=$textcolor&amp;name=$name&amp;centre=$centre&amp;x=$x&amp;y=$y&amp;angle=$angle&amp;font=$font&amp;size=$size&amp;select=255% 2C255%2C255&amp;color_r=$fontcolor['r']&amp;color_g=$fontcolor['g']&amp;color_b=$fontcolor['b']&amp;submit=Create+My+Sig%21/>
The variables are the same as i have on the creation page, which looks like:


<?php
header("Content-type: image/jpeg");

$name = stripslashes($_GET['name']);

$size = stripslashes($_GET['size']);

$centre = stripslashes($_GET['centre']);

$font = 'images/sig_maker/fonts/'.stripslashes($_GET['font']).'.ttf';

$fontcolor['r'] = stripslashes($_GET['color_r']); // font color - RED

$fontcolor['g'] = stripslashes($_GET['color_g']); // font color - GREEN

$fontcolor['b'] = stripslashes($_GET['color_b']); // font color - BLUE

$lines = stripslashes($_GET['lines']);

function arrow($im, $x1, $y1, $x2, $y2, $alength, $awidth, $color){
///

}

if(is_numeric($_GET['color']) && $_GET['color'] >= '1' && $_GET['color'] <= '47')
{
$bgpic = 'images/sig_maker/' . $_GET['color'] . '.jpeg';
}


$im = imagecreatefromjpeg($bgpic);

//Calculate, the centre:

for(;;){

list($image_width, $image_height) = getimagesize($bgpic);
list($left_x, , $right_x) = imagettfbbox($size, 0, $font, $name);
$text_width = $right_x - $left_x;
if($image_width > $text_width+5){

break;

}

$size = $size - .5;
if($size == 1){
die('Script not responding to decreasing font size, in other words: try using less letters.');
}

}
$hpadding = ($image_width - $text_width)/2;
$vpadding = ($image_height/2);

$textcolor = imagecolorresolve($im, $fontcolor['r'], $fontcolor['g'], $fontcolor['b']);
if($centre== 'y'){

imagettftext($im, $size, 0, $hpadding,$vpadding, $textcolor, $font, $name);

}else{

imagettftext($im, $size, $angle, $x, $y, $textcolor, $font, $name);

}

imagegif($im);
imagedestroy($im);
?>

and this is the important part of the form that sends them:

<form method="get" action="http://gamesigs.co.uk/creation.php" name="form" onsubmit="return checkit(this);">

When i change this form to go to the psge i have with the img src link on it it come up with a broken image. Where am i going wrong?

koyama
01-04-2007, 05:33 PM
I think there is a misplaced double quote in the <img> tag which should enclose the whole string. You should have something like this in your file:


<div>
<?php
echo '<img src="creation.php?color='.$textcolor.'&amp;name='.$name.'&amp;centre='.$centre'.&amp;x='.$x.'&amp;y='.$y.'&amp;angle='.$angle .'&amp;font='.$font.'&amp;size='.$size.'&amp;select=255%2C255%2C255&amp;color_r='.$fontcolor['r'].'&amp;color_g='.$fontcolor['g'].'&amp;color_b='.$fontcolor['b'].'&amp;submit=Create+My+Sig%21" />';
?>
</div>

To be sure that you have done it correctly you could in your browser say View > Source. If your code is processed correctly by php your image tag should then look something like:


<img src="creation.php?color=blue&amp;name=john&amp;..." />

digi duck
01-04-2007, 05:52 PM
that makes it come up with an error saying


Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /home/www/gamesigs.co.uk/userbars.php on line 100

and when i check in the source it hasnt processed them at all it still says $color etc instead of blue

koyama
01-04-2007, 06:00 PM
Sorry, I edited the above because I forgot a single quote and a semicolon. Try again, and if it doesn't work please post what you have for the page with the <img> tag.

digi duck
01-04-2007, 06:27 PM
it didnt work it came up with the same error.

This is the area aroufnd the part of the <Img> tag page


<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></td>
<td>&nbsp;</td>
</tr>
<tr>

<td height="320" colspan="6" valign="top"><div align="center"> <p align="center">
<div>
<?php
echo '<img src="creation.php?color='.$textcolor.'&amp;name='.$name.'&amp;centre='.$centre'.&amp;x='.$x.'&amp;y='.$y.'&amp;angle='.$angle .'&amp;font='.$font.'&amp;size='.$size.'&amp;select=255%2C255%2C255&amp;color_r='.$fontcolor['r'].'&amp;color_g='.$fontcolor['g'].'&amp;color_b='.$fontcolor['b'].'&amp;submit=Create+My+Sig%21" />';
?>
</div>
</p>
<iframe src="http://imageshack.us/iframe.php?txtcolor=111111&type=blank&size=30" scrolling="no" allowtransparency="true" frameborder="0" width="280" height="70">Update
your browser for ImageShack.us!</iframe> <div align="center"></div></tr>
<tr>
<td height="45" colspan="6" valign="top"><div align="center">
<p> <a href="http://gamesigs.co.uk/contact.php">Contact us</a></p>
<p><a href="http://gamesigs.co.uk">Gamesigs.co.uk</a> &copy; Copyright</p>
</div></tr>
</table></td>

koyama
01-04-2007, 07:14 PM
This part looks fine to me, but I could be wrong. The error, though, seems to come from higher up in the script. Check for some missing single or double quotes higher up or a missing closing ?>. The error doesn't have to be on line 100, but may well be at the beginning. If you don't find it I'm affraid you must post your entire file, then maybe someone can see the error.

CFMaBiSmAd
01-04-2007, 09:39 PM
There are swapped ' and . -
$centre'.&

should be -
$centre.'&

When building a comlex string that has PHP variables, it is easier to create, easier to read, and less error prone to enclose the entire string using double-quotes and then just place the variables within the string. Variables with [] need {} placed around them in order to keep the same syntax they would have outside of the string. This would become -

echo "<img src=\"creation.php?color=$textcolor&amp;name=$name&amp;centre=$centre&amp;x=$x&amp;y=$y&amp;angle=$angle&amp;font=$font&amp;size=$size &amp;select=255%2C255%2C255&amp;color_r={$fontcolor['r']}&amp;color_g={$fontcolor['g']}&amp;color_b={$fontcolor['b']}&amp;submit=Create+My+Sig%21\" />";

koyama
01-05-2007, 03:24 AM
Surely you have much better eyes than me CFMaBiSmAd :) lol

Also, thanks very much for your tip. I think I got the habbit of using single quotes because it broke syntax highlighting of variables in my editor (probably not a good one) and because I got tired of escaping the double quotes which I rather wanted I my HTML. But I see your point.:thumbsup:

digi duck
01-05-2007, 07:23 PM
thanks it half worked, i am no longer getting the error message. However the image is still not appearing it comes up with a broken link. if you want to see it so far go to www.gamesigs.co.uk/films.php and try it there.

koyama
01-05-2007, 11:51 PM
I think we are very close now.

In short, when you select options for creating your image, the data submitted should simply just be passed unaltered to the image generating script via the <img> tag. And they aren't--some are missing. This I can see by saying View > Source and looking at the <img> tag.

From what I can see in the URL string after the 'GET'-method form submission you should use this:


echo "<img src=\"creation.php?color={$_GET['color']}&amp;name={$_GET['name']}&amp;centre={$_GET['centre']}&amp;x={$_GET['x']}&amp;y={$_GET['y']}&amp;angle=$_GET['angle']&amp;font={$_GET['font']}&amp;size={$_GET['size']}&amp;color_r={$_GET['color_r']}&amp;color_g={$_GET['color_g']}&amp;color_b={$_GET['color_b']}\" />";

digi duck
01-06-2007, 12:04 PM
IVE DONE IT!!!

When i first input your code it came up with this error


Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING

but after a bit of googling i found out it was because it has unnecessary ' in it.

SO i changed the code from

echo "<img src=\"creation.php?color={$_GET['color']}&amp;name={$_GET['name']}&amp;centre={$_GET['centre']}&amp;x={$_GET['x']}&amp;y={$_GET['y']}&amp;angle=$_GET['angle']&amp;font={$_GET['font']}&amp;size={$_GET['size']}&amp;color_r={$_GET['color_r']}&amp;color_g={$_GET['color_g']}&amp;color_b={$_GET['color_b']}\" />";

to


echo "<img src=\"creation.php?color={$_GET[color]}&amp;name={$_GET[name]}&amp;centre={$_GET[centre]}&amp;x={$_GET[x]}&amp;y={$_GET[y]}&amp;angle=$_GET[angle]&amp;font={$_GET[font]}&amp;size={$_GET[size]}&amp;color_r={$_GET[color_r]}&amp;color_g={$_GET[color_g]}&amp;color_b={$_GET[color_b]}\" />";

Thanks so much for your help, i couldn't of done it without you.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum