NYCPHP Meetup

NYPHP.org

[nycphp-talk] (no subject)

Keith J Richardson Keith.Richardson at thompsonhealth.com
Thu Dec 18 12:13:32 EST 2003


Even with the post variables not workng poperly, I erased the post variables and used the defaults. This shows just a black circle, and thats it.

It also caches the image, so if you do a change, you have to go and remove the newImage.png file, so it stinks for testing it :P

-----Original Message-----
From: talk-bounces at lists.nyphp.org
[mailto:talk-bounces at lists.nyphp.org]On Behalf Of Brian Pang
Sent: Thursday, December 18, 2003 12:11 PM
To: NYPHP Talk
Subject: Re: [nycphp-talk] (no subject)


the $_POST vars are only scoped to the sendText.php file

you can't get them from recText.php

instead... call recText.php like this
recText.php?cont_mid=<?=$_POST['cont_mid']?>.....etc

since this is a GET, change $_POST in recText.php to $_GET


> 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/
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
> 
> 



_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk



More information about the talk mailing list