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
This commit is contained in:
Derick Rethans 2011-12-21 21:08:46 +00:00
parent 8395fed819
commit 37bff685c5

View file

@ -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
-->