Re: GD and arrays
| From: | Richard Lynch | Date: | Wed, 02 May 2001 08:00:08 +0000 |
| Subject: | Re: GD and arrays | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-51149@lists.php.net to get a copy of this message | ||
> I have the following case. I am working on a PHP script which contains an
> array. Now I want to include a PHP created picture, which is a .php file
> (gd, now further called as the picture.php file). Till so far, everything
is
> ok. The picture is created following as wished.
>
> Now , I want to include values in the picture.php file, which make use of
an
> array which is used in the program above.
> - I am not able to get any array accessed in the picture.php file!
>
> P.S. I am able to access single values in the picture.php. I am also able
to
> list out values of the araay in the script who calls the picture-php file.
>
> Can anybody give me a clue, how I can access the array in the picture.php
?
> Am I doing something wrong, or is this a bug (in that case I prefere a
> workaround).
Not sure I'm following this, but...
The PHP file that creates the GD image is a completely separate HTTP request
(file) from the main page, in the same way that any IMAGE is in a separate
file in a static site.
If both the main program and the image need access to an array of data, you
either need to pass that array to the picture.php file as a GET parameter
(or POST, I guess) or re-generate that array using the same code as in the
main program (possibly a good candidate for an include file).
So, in main.php, you might have some code that ends up generating something
not unlike:
<IMG SRC=picture.php?array[1]=17&array[2]=13&array[3]=32>
--
WARNING richard@zend.com address is not working -- Use ceo@l-i-e.com
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm