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

From: Date: Mon, 08 Jan 2001 14:34:44 +0000
Subject: Re: Different images getting saved to the same file??? (ImageJPEG)
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-33228@lists.php.net to get a copy of this message
Thanks for your help Matt. I tested it under FreeBSD and it works just fine. Unfortunately I am running on a NT box for a client and I found out that under NT there might be a problem associated with the creation of temporary files. Even with all directory permissions set right for user IUSR_NTMACHINENAME (the user with which some person will access my website through IIS) I always get the following message when trying to generate an image without saving it to disk: <b>Warning</b>: imagejpeg: unable to open temporary file in <b>C:\InetPub\MyWebDirectory\file_that_generates_the_image.php</b> on line <b>76</b><br> Can somebody confirm that under NT there is no way to create a temporary image file? (Perhaps when uploading a file through PHP under NT the same problem should occur?). I also verified if there was some problem with permissions relating the temporary upload directory setup in PHP.INI, and even changed this directory to be the same as the one reported by the browser (that is, I setup this temp upload directory to be the same as the one where my script is running - just for testing purposes, since this would not be an acceptable solution, even more because in IIS you shall have ONE global configuration in PHP.INI and that will affect all ISP's virtual subhosted accounts, as opposed to Apache where you can have specific configurations by using .htaccess files). Damn M$! FYI, check out also the following threads related with this problem: http://marc.theaimsgroup.com/?l=php-general&m=91445494204379&w=2 http://marc.theaimsgroup.com/?l=php-general&m=92214028508981&w=2 Thanks, Paulo ----- Original Message ----- From: Matt Whipple <brendel@adelphia.net> To: Paulo Parola <php@brazilinfo.com>; PHP List <php-general@lists.php.net> Sent: Monday, January 08, 2001 3:49 AM Subject: Re: [PHP] Different images getting saved to the same file??? (ImageJPEG) > 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=275910000000446787009 0 > >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=275910000000446787009 0 > >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 (#33228) next »