Reputation: 1828
I'm using Abraham's PHP library to connect with the twitter api.
Im trying to update the background profile, after authentication doing the following:
$connection = new TwitterOAuth($app['consumer_key'], $app['consumer_secret'], $session->oauth_token, $session->oauth_token_secret);
$background = "/controller/img/twitter_back.jpg";
$parameters = array(
'image' => '@' . $background . ';type=image/jpeg',
'tile' => 0,
'use' => 1,
'skip_status' => 1
);
$response = $connection->post('account/update_profile_background_image', $parameters);
print_r($response);
That outputs a blank page, and the response http code is 501, Im guessing its because Im not attaching the image correctly. The path to the image is correct, however Im not sure if the way im putting it as a parameter is correct.
I can do a verify_credentials
perfectly, so the Auth is not a problem.
Any ideas? Thanks.
Upvotes: 0
Views: 385
Reputation: 11106
Abraham'slibrary doesn't support multipart image uploads which is required by twitter. You can use Math Harris' library, it supports image uploads. Math Harris
And also you are to upload Base 64 encrypted images.
Upvotes: 0