There's an example in the tmhOAuth github project that has code for this:
   http://github.com/themattharris/tmhOAuth/blob/master/examples/images.php

The big difference for background images is remembering to send the filename
as well.
There have also been some users who have found that their version of curl
required changing 'image' => to '@image'

If neither of those work can you share the image that isn't working and
we'll see what could be the problem.

Best
---
@themattharris
Developer Advocate, Twitter
http://twitter.com/themattharris


On Mon, Oct 18, 2010 at 4:04 PM, x.charles.z <x.charle...@gmail.com> wrote:

> I used the exact same code for the profile pic update except changing
> the api function. The profile picture update works, but unfortunately
> the background image update fails.
>
>         $img_path = $_SERVER["DOCUMENT_ROOT"].'/images/twitter_bg/'.$image;
>
>         require_once('./application/libraries/tmhOAuth.php');
>
>          $oauth_tokens = $this->session->userdata('twitter_oauth_tokens');
>          $tmhOAuth = new tmhOAuth(array(
>            'consumer_key'    => T_CONSUMER_KEY,
>            'consumer_secret' => T_CONSUMER_SECRET,
>            'user_token'      => $oauth_tokens['access_token'],
>            'user_secret'     => $oauth_tokens['access_token_secret']
>         ));
>
>          $img_post = array('image' => "@{$img_path};type=image/jpeg;");
>
>
>         $tmhOAuth->request('POST', $tmhOAuth->url("account/
> update_profile_background_image"), $img_post,
>            true, // use auth
>            true  // multipart
>          );
>
> The picture is jpg and only 40kb
>
> The response I had:
>
>
> (
>           [date] => Mon, 18 Oct 2010 23:00:56 GMT
>           [server] => hi
>           [status] => 403 Forbidden
>           [x_transaction] => 1287442856-44067-31467
>
>
> [code] => 403
>   [response] => {"error":"There was a problem with your background
> image. Probably too big.","request":"/1/account/
> update_profile_background_image.json"}
>
>
> Thanks for taking a look.
>
> --
> Twitter developer documentation and resources: http://dev.twitter.com/doc
> API updates via Twitter: http://twitter.com/twitterapi
> Issues/Enhancements Tracker:
> http://code.google.com/p/twitter-api/issues/list
> Change your membership to this group:
> http://groups.google.com/group/twitter-development-talk
>

-- 
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
http://groups.google.com/group/twitter-development-talk

Reply via email to