diff --git a/src/TwitterOAuth.php b/src/TwitterOAuth.php index 37114c5b..f51cea88 100644 --- a/src/TwitterOAuth.php +++ b/src/TwitterOAuth.php @@ -421,9 +421,11 @@ private function mediaInitParameters(array $parameters): array 'media_category', 'shared', ]; + $file_headers = get_headers($parameters['media'], true); + $size = isset($file_headers['Content-Length'])?(int) $file_headers['Content-Length']:0; $base = [ 'command' => 'INIT', - 'total_bytes' => filesize($parameters['media']), + 'total_bytes' => $size, ]; $allowed_parameters = array_intersect_key( $parameters, @@ -799,4 +801,9 @@ private function setPostfieldsOptions( return $options; } + + public function img($url, $parameters = array()) { + $response = $this->oAuthRequest($url, 'GET', $parameters); + return $response; + } }