themattharris / tmhOAuth

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

Not updating image: update_profile_background_image #185

Closed 2s2d closed 9 years ago

2s2d commented 9 years ago

I'm using https://github.com/themattharris/tmhOAuth library for API calls. When i try update_profile_image all good:

$code = $tmhOAuth->request(
    'POST',
    $tmhOAuth->url('1.1/account/update_profile_image'),
    array('image'  => "@{$image_path};type=image/jpeg;filename={$name}"),
      true, // use auth
      true  // multipart
);

So, When i try update_profile_background_image with the same image:

$code = $tmhOAuth->request(
    'POST',
    $tmhOAuth->url('1.1/account/update_profile_background_image'),
    array('image'  => "@{$image_path};type=image/jpeg;filename={$name}"),
      true, // use auth
      true  // multipart
);

not updating. So, i try:

$params = array(
    'image' => "@{$file_link};type={$file_type};filename={$file_name}",
);                             
$params['use'] = 'true';

$code = $tmhOAuth->request('POST', $tmhOAuth->url("1.1/account/update_profile_background_image.json"),
    $params,
    true, // use auth
    true  // multipart
);
if ($code == 200)
    echo 'background image updated.';
else
    echo 'Something went worng!!';  

and the same result - nothing. Can you help?