PHP Class MongoGridFSFile

Author: Johannes Skov Frandsen ([email protected])
Afficher le fichier Open project: alcaeus/mongo-php-adapter Class Usage Examples

Méthodes publiques

Свойство Type Description
$file array

Protected Properties

Свойство Type Description
$gridfs

Méthodes publiques

Méthode Description
__construct ( MongoGridFS $gridfs, array $file )
getBytes ( ) : string This will load the file into memory. If the file is bigger than your memory, this will cause problems!
getFilename ( ) : string Returns this file's filename
getResource ( ) : resource This method returns a stream resource that can be used to read the stored file with all file functions in PHP.
getSize ( ) : integer Returns this file's size
write ( string $filename = null ) : integer Writes this file to the filesystem

Private Methods

Méthode Description
copyToResource ( $handle )
getChunks ( )

Method Details

__construct() public méthode

public __construct ( MongoGridFS $gridfs, array $file )
$gridfs MongoGridFS The parent MongoGridFS instance
$file array A file from the database

getBytes() public méthode

This will load the file into memory. If the file is bigger than your memory, this will cause problems!
public getBytes ( ) : string
Résultat string Returns a string of the bytes in the file

getFilename() public méthode

Returns this file's filename
public getFilename ( ) : string
Résultat string Returns the filename

getResource() public méthode

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.
public getResource ( ) : resource
Résultat resource Returns a resource that can be used to read the file with

getSize() public méthode

Returns this file's size
public getSize ( ) : integer
Résultat integer Returns this file's size

write() public méthode

Writes this file to the filesystem
public write ( string $filename = null ) : integer
$filename string The location to which to write the file (path+filename+extension). If none is given, the stored filename will be used.
Résultat integer Returns the number of bytes written

Property Details

$file public_oe property

public array $file
Résultat array

$gridfs protected_oe property

protected $gridfs