themattharris / tmhOAuth

An OAuth 1.0A library written in PHP
Apache License 2.0
855 stars 335 forks source link

update_profile_background_image not updating the bg image (Not a library issue) #173

Closed ilayas closed 10 years ago

ilayas commented 10 years ago

Hi,

I've tried to update the profile background image using https://dev.twitter.com/docs/api/1.1/post/account/update_profile_background_image. The API returns 200 as status code but the BG image is not updated. I'm using https://github.com/themattharris/tmhOAuth library for API calls.

And the the documentation says, we could use any of the arguments, but when I try only 'use' parameter, API returns error saying 'image' param is missing.

my code as follows:

$tmhOAuth = new tmhOAuth( [ 'consumer_key' => 'consumer_key', 'consumer_secret' => 'consumer_secret', 'user_token' => 'user_token', 'user_secret' => 'user_secret' ] );

$params = [ 'image' => '@'.DOC_ROOT.'/assets/img/location_1.png;type=image/png;filename=location_1.png', 'use' => 'true' ];

$code = $tmhOAuth->request('POST', $tmhOAuth->url("1.1/account/update_profile_background_image.json"), $params, true, // use auth true // multipart );

Help me to fix the issue.

Thanks,

themattharris commented 10 years ago

i know this is an old issue but incase it helps the error you are getting from the Twitter API can often be attributed to the image param being set, but the image data not existing.

double check that the file at '.DOC_ROOT.'/assets/img/location_1.png exists and is readable.