jdolitsky / AppDotNetPHP

PHP library for the App.net Stream API
34 stars 19 forks source link

The @-reference to CurlFile() instance I missed #59

Closed cdn closed 4 years ago

cdn commented 8 years ago

diff --git a/AppDotNet.php b/AppDotNet.php index c55e5b1..f681803 100644 --- a/AppDotNet.php +++ b/AppDotNet.php @@ -1020,7 +1020,11 @@ class AppDotNet { * @image path reference to image */ protected function updateUserImage($which = 'avatar', $image = null) { -- $data = array($which=>"@$image"); ++ $test = @getimagesize($image); ++ if ($test && array_key_exists('mime',$test)) { ++ $mimeType = $test['mime']; ++ } ++ $data = array($which=>new CurlFile($image, $mimeType)); return $this->httpReq('post-raw',$this->_baseUrl.'users/me/'.$which, $data, 'multipart/form-data'); }