NYCPHP Meetup

NYPHP.org

[nycphp-talk] (no subject)

Cloud N. northcloud2000 at yahoo.com
Thu Dec 18 11:53:18 EST 2003


Hello, 

Are there anyone who can tell me how come it is?
Thanks alot in advance.

I try to input some text from first page
(sendText.php), then pass the text to second file
(recText.php) to generate an image, then shows the
image up in first page, but those texts don't be added
to the image. If I put some fixed text in second file
(recText.php - commend out ling 6-8), it works (it
mekes sense). How can I check what variables be passed
to second file? any function can do it?


Rena
----------

two parts code are below:

-----------
<?php
// sendText.php
?>

<html>
<body>
<form name="detail" method="post"
action="<?=$_SERVER['PHP_SELF'];?>">

<table>
<tr><td>
   <table border="1" BORDERCOLOR="blue">
   
      <tr><td>
      Input new content for top line:
&nbsp;&nbsp;&nbsp;&nbsp;
      <input type="text" name="cont_top" size=10><br>
      </td></tr>

      <tr><td>
      Input new content for middle line:
      <input type="text" name="cont_mid" size=10><br>
      </td></tr>
   
      <tr><td>
      Input new content for bottom line:
      <input type="text" name="cont_bottom"
size=10><br>
      </td></tr>
   
   
      <tr><td>
      <input type="submit" value='Submit'
name='submit'>
      <input type="hidden" value="true" name="send">
      </td></tr>
   
   </table>
</td>
<td>
<div>
<?php
if($_POST['send'] == "true")
echo ("<img src=\"recText.php\"><br><br>");
?>
</div>



</td>
</table>
</form>
</body>
</html>
--------------
<?php
// recText.php

      $c_top = "this is top";
      $c_mid = "this is middle";
      $c_btm = "this is bottom";

      $c_top = $_POST['cont_top'];  // line 6
      $c_mid = $_POST['cont_mid'];  // line 7
      $c_btm = $_POST['cont_bottom'];  // line 8

      $new_id = "newImage";

      $imgCache = @ImageCreateFromPNG ("$new_id.png");

      if($imgCache)       // if existing
      {
         ImagePNG($imgCache);
      }
      else               // if not existing
      {
// create image

         $image = imagecreate(270, 270);
         $white    = imagecolorallocate($image, 255,
255, 255);
         $red      = imagecolorallocate($image, 255,
0, 0);
         $black    = imagecolorallocate($image, 0, 0,
0);
         $Tan    = imagecolorallocate($image, 222,
184, 135);

         imagefilledarc($image, 135, 135, 270, 270, 0,
360 , $black, IMG_ARC_PIE);


         Imagettftext($image, 10, 0, 100, 50,
$red,'arial.ttf', $c_top);
         Imagettftext($image, 20, 0, 70, 130,
$red,'arial.ttf', $c_mid);
         Imagettftext($image, 10, 0, 100, 210,
$red,'arial.ttf', $c_btm);

         header('Content-type: image/png');
         ImagePng($image, "$new_id.png");
         $imgcache = @ImageCreateFromPNG
("$new_id.png");
         ImagePNG($imgcache);
   imagedestroy($image);
      }   //end of imgCache

?>


__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/



More information about the talk mailing list