From 37bff685c57167d5e40b82629c70bd1b3c22f3d6 Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Wed, 21 Dec 2011 21:08:46 +0000 Subject: [PATCH] Added documentation for the new MongoGridFSFile method getResource(). Not quite sure how to mark that this will only be there from 1.3.0. Any hints? git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@321303 c90b9560-bf6c-de11-be94-00142212c4b1 --- .../mongo/mongogridfsfile/getresource.xml | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 reference/mongo/mongogridfsfile/getresource.xml diff --git a/reference/mongo/mongogridfsfile/getresource.xml b/reference/mongo/mongogridfsfile/getresource.xml new file mode 100644 index 0000000000..ea1f0bad92 --- /dev/null +++ b/reference/mongo/mongogridfsfile/getresource.xml @@ -0,0 +1,81 @@ + + + + + + MongoGridFSFile::getResource + Returns a resource that can be used to read the stored file + + + + &reftitle.description; + + public streamMongoGridFSFile::getResource + + + + This method returns a stream resource that can be used with all file + functions in PHP. The contents of the file are pulled out of MongoDB on the + fly, so that the whole file does not have to be loaded into memory first. + + + At most two GridFSFile chunks will be loaded in memory. + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + Returns a resource that can be used to read the file with + + + + + &reftitle.examples; + + <methodname>MongoGridFSFile::getResource</methodname> example + +my_db->getGridFS('images'); + +$image = $images->findOne('mongo.png'); + +header('Content-type: image/png;'); +$stream = $image->getResource(); + +while (!feof($stream)) { + echo fread($stream, 8192); +} +?> +]]> + + + + + +