64 public function __construct($filePath, $maxLength = -1, $offset = -1)
66 $this->path = $filePath;
67 $this->maxLength = $maxLength;
68 $this->offset = $offset;
87 if (!$this->
isRemoteFile($this->path) && !is_readable($this->path)) {
88 throw new FacebookSDKException(
'Failed to create FacebookFile entity. Unable to read resource: ' . $this->path .
'.');
91 $this->stream = fopen($this->path,
'r');
94 throw new FacebookSDKException(
'Failed to create FacebookFile entity. Unable to open resource: ' . $this->path .
'.');
103 if (is_resource($this->stream)) {
104 fclose($this->stream);
115 return stream_get_contents($this->stream, $this->maxLength, $this->offset);
125 return basename($this->path);
145 return filesize($this->path);
167 return preg_match(
'/^(https?|ftp):\/\/.*/', $pathToFile) === 1;