note 13753 deleted from function.imagecreatefromgif by betz

From: Date: Thu, 10 Jun 2004 09:19:00 +0000
Subject: note 13753 deleted from function.imagecreatefromgif by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-70866@lists.php.net to get a copy of this message
Note Submitter: fabianfranz@gmx.de ---- To the above example for the function <pre> function myImageCreateFromGif($file_or_url) { $dummy_file = "/tmp/dummy.gif"; and later # write the contents to a dummy file $output = fopen("$dummy_file", "wb"); It would be better, to create the $output with tmpfile(); i.e.: $output = tmpfile(); Then you can also leave the unlink out, because you can simply close the file: i.e. fwrite($output, $image_data); # create the gif from the dummy file $image = ImageCreateFromGif($dummy_file); # get rid of the dummy file fclose($output); Please, remember that the file is deleted, when it is closed ...

« previous php.notes (#70866) next »