request("flickr.photos.getSizes", array("photo_id"=>$photo_id));
return $this->parsed_response ? $this->parsed_response['sizes']['size'] : false;
}
*/
/*
Small Test Class5Photo
*/
require_once("phpFlickr.php");
$f = new phpFlickr("your api key goes in here"); // to run this script you need to apply for a flickr api key
//$f->enableCache(
// "db",
// "mysql://[DB User]:[DB Password]@[DB Server]/[DB Name]"
//);
//imported functions
function DumpArrayToTable ( $arDest )
{
// Random-Farbe fuer den Rand der Tabellen.
$iBorderColor = str_pad ( mt_rand ( 0, 999999 ), 6,
'0', STR_PAD_LEFT );
print ( '
' );
// Wenn kein Array, dann Input in ein Array umwandeln.
if ( ! is_array ( $arDest[0] ) )
{
$arDest = array ( $arDest );
}
print ( '' );
// Schluessel des Arrays als Tabellenspaltenueberschrift.
foreach ( array_keys ( $arDest[0] ) as $strTmpT )
{
$strType = 'Type: ' . gettype ( $strTmpT );
print ( '| ' . $strTmpT . ' | ' );
}
print ( '
' );
// Array durchlaufen.
foreach ( $arDest as $arTmpElm )
{
print ( '' );
foreach ( $arTmpElm as $strTmpVal )
{
$strType = 'Type: ' . gettype ( $strTmpVal );
print ( '| ' );
if ( is_array ( $strTmpVal ) && ! empty ( $strTmpVal ) )
{
// Wenn ein Array in einem Array, dann
// rekursiv DumpArrayToTable aufrufen.
DumpArrayToTable ( $strTmpVal );
}
else
{
if ( ! empty ( $strTmpVal ) )
{
print ( $strTmpVal );
}
else
{
// Wenn aktuelles Array-Element leer ist,
// dann Tabellenzelle mit "empty" markieren.
print ( 'empty' );
}
}
print ( ' | ' );
}
print ( '
' );
}
print ( '
' );
}
//future functions
echo "Andreas is testing
";
$ahtestvar_size=$f->photos_getSizes(3016391671 ); //no large size
$ahtestvar_size=$f->photos_getSizes(3017098437 );
$anzahl=count ($ahtestvar_size); echo " Size array count: ".$anzahl; echo"
";
echo "new count: ".count ($f->photos_getSizes(3016391671 ));
echo "Sizeof: ".Sizeof ($ahtestvar_size)."
";
echo "label: ".$ahtestvar_size['1']."
";
echo "
";
DumpArraytoTable ($ahtestvar_size);
echo "
";
//echo "popping count".count (array_pop ($ahtestvar_size)); echo " that was array popping
";
//for ($i=0; $i < $anzahl; $i++){
// echo count ($ahtestvar_size [$i]);}
// echo "
";
$ahtestvar_fav=$f->photos_getFavorites(1849620468 );
echo "Favorites #: ".$ahtestvar_fav['total']."
";
echo "counting favorites".count ($ahtestvar_fav); echo"
";
echo "
";
DumpArrayToTable ($ahtestvar_fav);
//echo "$f->buildPhotoURL(3018162068/*$photo*/, "large")"
//http://l.yimg.com/www.flickr.com/images/photo_unavailable.gif
//echo "
";
echo "
end of initial testing
";
if (!empty($_POST['username'])) {
$person = $f->people_findByUsername($_POST['username']);
$groups = $f->people_getPublicGroups($person['id']);
shuffle ($groups); //randomizes the group list // !!! here his the essential group randomization
foreach ((array)$groups as $group) {
echo "\n";
$photos = $f->groups_pools_getPhotos($group['nsid'], NULL, NULL, NULL, 8);
//last number is the number of photos per group
foreach ((array)$photos['photo'] as $photo) {
//find out about the size
if (count ($f->photos_getSizes($photo['id'] )) > 5) {
//!echo " ID: "; echo $photo['id']." ";
// $ah_photo_size = $f->photos_getSizes($photo['id']);
// echo " size [1]: "; echo $ah_photo_size [1]; echo"
";
//create the img URL
$ahtestvar_fav=$f->photos_getFavorites($photo['id'] );
echo "F ".$ahtestvar_fav['total']." "; //echo "
";
if ( $ahtestvar_fav ['total'] > 2) {
echo "";
/*echo*/ $ahtestvar="
";
echo "$ahtestvar"; // this is almost the complete URL of the image
//figuring out how to get info about size and favorites
//$ahtesting2 = $f->buildPhotoURL($photo, "large");
//echo "$ahtesting2";
//figuring out how to get info about size and favorites
//$ahtestvarfav=$f->photos_getFavorites($photo);
//echo count ($ahtestvarfav); echo"
";
//! echo ""; echo "
";}
} else
{
/*echo " ID: "; echo $photo['id']." ";+/
//create the img URL
$ahtestvar_fav=$f->photos_getFavorites($photo['id'] );
echo "Favorites: ".$ahtestvar_fav['total']." ";echo "
";
if ( $ahtestvar_fav ['total'] > 2) {
echo "";
/*echo*/ $ahtestvar="
";
echo "$ahtestvar"; // this is almost the complete URL of the image
//figuring out how to get info about size and favorites
//$ahtesting2 = $f->buildPhotoURL($photo, "large");
//echo "$ahtesting2";
//figuring out how to get info about size and favorites
//$ahtestvarfav=$f->photos_getFavorites($photo);
//echo count ($ahtestvarfav); echo"
";
//!echo ""; echo "
";
}
} else
{
//!echo " ID: "; echo $photo['id']." ";
// $ah_photo_size = $f->photos_getSizes($photo['id']);
// echo " size [1]: "; echo $ah_photo_size [1]; echo"
";
//create the img URL
$ahtestvar_fav=$f->photos_getFavorites($photo['id'] );
echo "F ".$ahtestvar_fav['total']." "; //echo "
";
if ( $ahtestvar_fav ['total'] > 2) {
echo "";
/*echo*/ $ahtestvar="
";
echo "$ahtestvar"; // this is almost the complete URL of the image
//figuring out how to get info about size and favorites
//$ahtesting2 = $f->buildPhotoURL($photo, "large");
//echo "$ahtesting2";
//figuring out how to get info about size and favorites
//$ahtestvarfav=$f->photos_getFavorites($photo);
//echo count ($ahtestvarfav); echo"
";
//! echo ""; echo "
";}
} else
{
/*echo " ID: "; echo $photo['id']." ";+/
//create the img URL
$ahtestvar_fav=$f->photos_getFavorites($photo['id'] );
echo "Favorites: ".$ahtestvar_fav['total']." ";echo "
";
if ( $ahtestvar_fav ['total'] > 2) {
echo "";
/*echo*/ $ahtestvar="
";
echo "$ahtestvar"; // this is almost the complete URL of the image
//figuring out how to get info about size and favorites
//$ahtesting2 = $f->buildPhotoURL($photo, "large");
//echo "$ahtesting2";
//figuring out how to get info about size and favorites
//$ahtestvarfav=$f->photos_getFavorites($photo);
//echo count ($ahtestvarfav); echo"
";
//!echo ""; echo "
";
}
}
}
}
}
echo "Enter a username to search for
";
echo "";
?>