Reply to Re: Need help modifying this PHP script

Your name:

Reply:


Posted by Malcolm Dew-Jones on 11/15/36 11:23

yvan@atzilut.com wrote:
: I was wondering if someone here could help me with modifying this PHP
: template so that it does something very specific for me. My knowledge
: of PHP is very limited (I'm more of a Cold Fusion developer), which is
: why I'm inquiring here.

: Anyways, first I'll show you the PHP code, and then I'll explain what
: kind of modification I need to have applied:

: ------------------------------------------------------------------------------
: <?
: include ("config.php");
: include("imgprocess.php");

: //create a php code that will be evaluated later, each time displaying
: the image...

: $imgdata =
: "\$points=\"$points\";\$colors=\"$colors\";\$pencilwidths=\"$pencilwidths\";";

: //...pack it in a compressed archive...

: $newgzfile = gzopen($newid.".gz", "w9");
: gzwrite($newgzfile, $imgdata);
: gzclose($newgzfile);

: //...and free some memory.

: unset ($imgdata);

: //create virtualy the image from the flash compression algorythm;

: $image=makeimg();

: //create physically the thumbnail from our gd virtual image.

: $image2 = ImageCreate($thumbsize,$thumbsize);
: imagecopyresized ( $image2 , $image , 0 , 0 , 0 , 0 , $thumbsize
: ,$thumbsize, 450 ,450 ) ;
: if($thumbformat == "jpg"){
: Imagejpeg($image2,"temp".$newid.".jpg",$thumbquality);
: }else{
: Imagepng($image2,"temp".$newid.".png");
: }
: //now lets tell flash every thing is ok

: echo "everything=okaisayhellotoyourmama";

: ?>
: ------------------------------------------------------------------------------

: This PHP file, as best as I can tell, writes a file named "temp.jpg" to
: a specific directory on the server (defined in the config.php file).
: What I need is to have the template modified so that it "waits" to
: make sure that the file named "temp.jpg" DOES NOT EXIST at that
: location before attempting to write the file. I've written some Cold
: Fusion routines which promptly rename the temp.jpg files and moves them
: to a different location, but since this will be used in a multi-user
: environment, I have to make sure that temp.jpg never gets overwritten.
: I'm not sure if this is even possible to accomplish or not, but I thank
: you in advance for whatever assistance you can offer.

: Cheers,
: - yvan

Make the various instances of the script cooperate by using a unique name
each time for the temporary file.

The "uniqid" function may be appropriate for this task.

At the top of the code you create a string that is the unique name, then
later on the script uses that name. Each instance will have a different
name.

I can't show you exactly because the code you show does not seem to
include all the accesses to the file being created.


--

This space not for rent.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация