Skip to content

Commit

Permalink
Merge pull request jublo#20 from MilesOkeefe/patch-1
Browse files Browse the repository at this point in the history
Update README.md
  • Loading branch information
mynetx committed May 16, 2013
2 parents dda176a + 30fcada commit a4a5d34
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,28 +246,19 @@ How Do I…?
…access a user’s profile image?
-------------------------------

The Twitter API usually contains data in either JSON or XML. However, the
templated method ```users/profile_image/:screen_name``` uses a HTTP 302 redirect
to send you to the requested image file URL.
First retrieve the user object using

Codebird intercepts this HTTP redirect and extracts the profile image URL instead.
Thus, the following API call:
```$reply = $cb->users_show("screen_name=$username");```

```php
$reply = $cb->users_profileImage_SCREEN_NAME('screen_name=mynetx&size=mini');
```

returns an object with the following contents:
```
stdClass Object
(
[profile_image_url_https] => https://si0.twimg.com/profile_images/1417135246/Blue_Purple.96_mini.png
[httpstatus] => 302
)
```
with ```$username``` being the username of the account you wish to retrieve the profile image from.

Then get the value from the index ```profile_image_url``` or ```profile_image_url_https``` of the user object previously retrieved.


For example:

You can find out how to build the Codebird method name, in the section
‘Mapping API methods to Codebird function calls.’
```$reply['profile_image_url']``` will then return the profile image url without https.

…get user ID, screen name and more details about the current user?
------------------------------------------------------------------
Expand Down

0 comments on commit a4a5d34

Please sign in to comment.