PHP Класс MongoGridFSFile

Автор: Johannes Skov Frandsen ([email protected])
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$file array

Защищенные свойства (Protected)

Свойство Тип Описание
$gridfs

Открытые методы

Метод Описание
__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

Приватные методы

Метод Описание
copyToResource ( $handle )
getChunks ( )

Описание методов

__construct() публичный Метод

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

getBytes() публичный Метод

This will load the file into memory. If the file is bigger than your memory, this will cause problems!
public getBytes ( ) : string
Результат string Returns a string of the bytes in the file

getFilename() публичный Метод

Returns this file's filename
public getFilename ( ) : string
Результат string Returns the filename

getResource() публичный Метод

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
Результат resource Returns a resource that can be used to read the file with

getSize() публичный Метод

Returns this file's size
public getSize ( ) : integer
Результат integer Returns this file's size

write() публичный Метод

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.
Результат integer Returns the number of bytes written

Описание свойств

$file публичное свойство

public array $file
Результат array

$gridfs защищенное свойство

protected $gridfs