svn: /phpdoc/en/trunk/reference/mongo/mongogridfsfile/ getresource.xml
| From: | Derick Rethans | Date: | Wed, 21 Dec 2011 21:08:46 +0000 |
| Subject: | svn: /phpdoc/en/trunk/reference/mongo/mongogridfsfile/ getresource.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-9266@lists.php.net to get a copy of this message | ||
derick Wed, 21 Dec 2011 21:08:46 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=321303
Log:
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?
Changed paths:
A phpdoc/en/trunk/reference/mongo/mongogridfsfile/getresource.xml
Added: phpdoc/en/trunk/reference/mongo/mongogridfsfile/getresource.xml
===================================================================
--- phpdoc/en/trunk/reference/mongo/mongogridfsfile/getresource.xml (rev 0)
+++ phpdoc/en/trunk/reference/mongo/mongogridfsfile/getresource.xml 2011-12-21 21:08:46 UTC (rev
321303)
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- $Revision: 299506 $ -->
+<refentry xml:id="mongogridfsfile.getresource" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
+ <refnamediv>
+ <refname>MongoGridFSFile::getResource</refname>
+ <refpurpose>Returns a resource that can be used to read the stored file</refpurpose>
+ </refnamediv>
+
+ <refsect1 role="description">
+ &reftitle.description;
+ <methodsynopsis>
+ <modifier>public</modifier>
<type>stream</type><methodname>MongoGridFSFile::getResource</methodname>
+ <void/>
+ </methodsynopsis>
+ <para>
+ 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.
+ </para>
+ <para>
+ At most two GridFSFile chunks will be loaded in memory.
+ </para>
+ </refsect1>
+
+ <refsect1 role="parameters">
+ &reftitle.parameters;
+ &no.function.parameters;
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <para>
+ Returns a resource that can be used to read the file with
+ </para>
+ </refsect1>
+
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <example>
+ <title><methodname>MongoGridFSFile::getResource</methodname>
example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$m = new Mongo;
+$images = $m->my_db->getGridFS('images');
+
+$image = $images->findOne('mongo.png');
+
+header('Content-type: image/png;');
+$stream = $image->getResource();
+
+while (!feof($stream)) {
+ echo fread($stream, 8192);
+}
+?>
+]]>
+ </programlisting>
+ </example>
+ </refsect1>
+
+</refentry>
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->