Re: Different images getting saved to the same file??? (ImageJPEG)

From: Date: Mon, 08 Jan 2001 05:49:30 +0000
Subject: Re: Different images getting saved to the same file??? (ImageJPEG)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-33187@lists.php.net to get a copy of this message
Sorry for the late reply but I wanted to quickly test to see what worked and I had a little problem getting gd set up on my computer. Put all the image generation code in the file_that_actually_shows_the_image.php file, and just include the parameters necessary to generate the image in the img src target. If the image php file isn't getting parsed then check for any typos. I'd recommend entering the "file_that_actually_shows_the_image.php" address with parameters directly into your browser or creating a href link to test it so that any errors are displayed. I did a basic test and it seemed to work fine (with PHP4 installed as an Apache module...don't know if there could be a problem with another configuration).
        -Matt
At 10:16 PM 1/7/2001 -0200, Paulo Parola wrote:
Could you give me an example? My problem is I output a lot of HTML before the image, so I imagine I have to split my code into 2 files, one where I generate the image (lets say stored into variable $pic), and then issue an <img src= ...> tag passing as parameter the name of the file that actually generates the image. Something like: echo "<img src=\"./file_that_actually_shows_the_image.php?image=$pic\" border=\"0\" />"; And in file "file_that_actually_shows_the_image.php" I would have something like: <? Header("Content-type: image/jpg"); ImageJPEG($pic); ImageDestroy($pic); ?> But then I only got the following HTML output: <img src="./file_that_actually_shows_the_image.php?image=Resource id #1" border="0" /> Or maybe I should reference the file as: <img src="./file_that_actually_shows_the_image.php?barcode=2759100000004467870090 1008765010000000040001" border="0" /> and then inside "file_that_actually_shows_the_image.php" I would do all the calculations to generate the image from the number passed as parameter and then output the image like below: <? Header("Content-type: image/jpg"); ... Here I get the value of the barcode parameter, either using HTTP_SERVER_VARS["argv"] or maybe 'urldecode'; Secondly I perform the algorithm to actually generate the image into variable $pic ... ImageJPEG($pic); ImageDestroy($pic); ?> I tried that but I also only got a broken image (the referenced PHP file did not get interpreted): <img src="./file_that_actually_shows_the_image.php?barcode=2759100000004467870090 1008765010000000040001" border="0" /> What is the correct way to do that? Thanks, Paulo ----- Original Message ----- From: Matt Whipple <brendel@adelphia.net> To: Paulo Parola <php@brazilinfo.com>; PHP List <php-general@lists.php.net> Sent: Sunday, January 07, 2001 8:13 PM Subject: Re: [PHP] Different images getting saved to the same file??? (ImageJPEG) If you don't have to save the files then why not just output to the browser without writing a file? -Matt At 07:53 PM 1/7/2001 -0200, Paulo Parola wrote:
I am creating a barcode using function ImageJPEG as below: ImageJPEG($picture,"./temp/graph.jpeg"); The image created is different according to the values informed by the user in a form. A file named 'graph.jpeg' is created in directory 'temp' and the image is shown to the user when he submits the form. Now, how can I be sure that some user is not going to have the image resulting from some other user's form submission shown at his browser if
I
always specify the same filename for the image created? ==> Do I have to create different image filenames, lets say by naming the image files after some combination of the user's Session ID or IP
address?
And then (if this is the case) how should I get rid of the files
created
on the hard disk? Thanks, Paulo
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net


« previous php.general (#33187) next »