diff options
author | emkael <emkael@tlen.pl> | 2018-04-26 01:00:12 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2018-04-26 01:00:12 +0200 |
commit | 4b8a9a5189a625bf99fedec7fd31f6e146410a14 (patch) | |
tree | a29759d5f0f0c29f07c89c59f6b5cf38407d1470 /lib/facebook-graph-sdk/src/Facebook/FileUpload/FacebookFile.php | |
parent | ab82beef33f4c196383a81213dcdff4ebe9447ae (diff) |
Update FB API library
Diffstat (limited to 'lib/facebook-graph-sdk/src/Facebook/FileUpload/FacebookFile.php')
-rw-r--r-- | lib/facebook-graph-sdk/src/Facebook/FileUpload/FacebookFile.php | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/lib/facebook-graph-sdk/src/Facebook/FileUpload/FacebookFile.php b/lib/facebook-graph-sdk/src/Facebook/FileUpload/FacebookFile.php index f8b9905..3c1536d 100644 --- a/lib/facebook-graph-sdk/src/Facebook/FileUpload/FacebookFile.php +++ b/lib/facebook-graph-sdk/src/Facebook/FileUpload/FacebookFile.php @@ -1,6 +1,6 @@ <?php /** - * Copyright 2014 Facebook, Inc. + * Copyright 2017 Facebook, Inc. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to * use, copy, modify, and distribute this software in source code or binary @@ -38,6 +38,16 @@ class FacebookFile protected $path; /** + * @var int The maximum bytes to read. Defaults to -1 (read all the remaining buffer). + */ + private $maxLength; + + /** + * @var int Seek to the specified offset before reading. If this number is negative, no seeking will occur and reading will start from the current position. + */ + private $offset; + + /** * @var resource The stream pointing to the file. */ protected $stream; @@ -46,12 +56,16 @@ class FacebookFile * Creates a new FacebookFile entity. * * @param string $filePath + * @param int $maxLength + * @param int $offset * * @throws FacebookSDKException */ - public function __construct($filePath) + public function __construct($filePath, $maxLength = -1, $offset = -1) { $this->path = $filePath; + $this->maxLength = $maxLength; + $this->offset = $offset; $this->open(); } @@ -98,7 +112,7 @@ class FacebookFile */ public function getContents() { - return stream_get_contents($this->stream); + return stream_get_contents($this->stream, $this->maxLength, $this->offset); } /** @@ -112,6 +126,26 @@ class FacebookFile } /** + * Return the path of the file. + * + * @return string + */ + public function getFilePath() + { + return $this->path; + } + + /** + * Return the size of the file. + * + * @return int + */ + public function getSize() + { + return filesize($this->path); + } + + /** * Return the mimetype of the file. * * @return string |