The following is just a proof of concept and creates a menu item in the dashboard with the results of the Flickr API response.

add_action( 'admin_menu', function()
{
add_menu_page(
'Flicker',
'Flicker',
'add_users',
'fck_admin',
'consult_flickr_api_so_7173971',
'https://i.stack.imgur.com/s2ons.png',
2
);
});
function consult_flickr_api_so_7173971()
{
$api_key = 'YOUR-KEY';
$secret_key = 'YOUR-SECRET'; // not needed for public data
$uid = 'USER-ID-TO-CONSULT';
$url = 'https://api.flickr.com/services/rest/?&method=flickr.people.getPublicPhotos&api_key='
. $api_key
. '&user_id='
. $uid
. '&format=json&nojsoncallback=1&per_page=15'; // maximum 500
$flickr = wp_remote_get( $url, array( 'timeout' => 120, 'httpversion' => '1.1' ) );
if ( $flickr['response']['code'] == '200' )
{
$flickr_array = json_decode( $flickr['body'], true );
foreach( $flickr_array['photos']['photo'] as $photo )
{
echo '<h2>' . $photo['title'] . '</h2>';
get_flickr_photo_so_7173971( $photo['id'] );
}
}
}
/**
http://www.flickr.com/services/api/
Useful Methods
- getExif
- getInfo
- getSizes
*/
function get_flickr_photo_so_7173971( $photo_id, $method = 'getSizes' )
{
$api_key = 'YOUR-KEY';
$flickr = wp_remote_get(
'https://api.flickr.com/services/rest/?&method=flickr.photos.'
. $method
. '&api_key='
. $api_key
. '&photo_id='
. $photo_id
. '&format=json&nojsoncallback=1',
array(
'timeout' => 120,
'httpversion' => '1.1'
)
);
if ( $flickr['response']['code'] == '200' )
{
$flickr_array = json_decode( $flickr['body'], true );
$no_print = true;
foreach( $flickr_array['sizes']['size'] as $size )
{
if( $size['label'] == 'Medium' ) {
print_photo_so_7173971( $size );
$no_print = false;
}
}
// No medium size was found, just print the first one
if( $no_print )
{
print_photo_so_7173971( $flickr_array['sizes']['size'][0] );
}
}
}
function print_photo_so_7173971( $size )
{
printf(
'<img src="%s" width="%s" height="%s" /><br />',
$size['source'],
$size['width'],
$size['height']
);
}
I'll leave the manipulation of these results to the reader.
Suggestions:
- Set up a cron job to pull the information and do your stuff. Use this as reference: Website widget to display Apple App store price drops?
- Create an options page and display the results with thumbnails, extended info and buttons to dispatch some action (image side load, create new post, etc), see here and here.
WordPress StackExchange is full of nice snippets and techniques.