phpphpflickr

phpflickr - how to get a photo owners username by owner id?


<?php 
//...

$tags = $api->photos_search(array(
    'text' => 'stuff',
));

foreach ($tags['photo'] as $photo) {
    // want to get get the user's actual username from the the "owner"
    $ownerId = $photo['owner'];
    // getUsernameById($ownerId); // <-- how do you do this?
}

Solution

  • I have never used that library, but according to the Flickr API, the function is called originally flickr.people.getInfo.

    That PHP class follows this naming convention. I would try

    $userinfo = $api->people_getInfo($ownerId);
    var_dump($userinfo['username']);
    

    Good luck!