Twicon

Get Twitter User Icon Image URL library written in PHP.


Project maintained by teriyakisan Hosted on GitHub Pages — Theme by mattgraham

twicon

Get Twitter User Icon Image URL library written in PHP.

You can work around API limitation get the image URL via the API, because it caches to memcached.

Usage

redirect directly

$twicon = new Twicon();
$twicon->out($twitterId, $size);

example

embed url in image source

$twicon = new Twicon();
$src = $twicon->getIconUrl($id, $size);
echo '<img src="' . $src . '" alt="" />';

example

Twicon

Twicon::out

void Twicon:out ( int $id [,int $size = 0 ] )

Reedirect pure Twitter icon URL directly.

If referer page is SSL, redirect SSL icon url.

Parameters

Return Values

Returns none on success or dummy gif binary on failure.

Twicon::getIconUrl

mixed Twicon::getIconUrl ( int $id [,int $size = 0 [, bool $sslFlg = false ]] )

Returns Twitter icon URL string.

Parameters

Return Values

Returns Twitter icon URL on success or FALSE on failure.

Twicon::getMemcachedStatus

bool Twicon::getMemcachedStatus ()

Returns connect memcached server status.

Return Values

Returns TRUE on success or FALSE on failure.

Configuration

config/memcached.ini is optional memcached settings file(If it's none, using default settings).

You need to write settings in memcached section.

Dependent Library / Module

Tests

The tests can be executed by using this command from the base directory.

phpunit --stderr --bootstrap tests/bootstrap.php tests/tests.php

Licence

Copyright (c) 2012 Hiroki Tanaka

The MIT License (MIT) http://www.opensource.org/licenses/MIT