enableCache("fs",/* put yours here */);
$thisPhoto = "";
$allPhotos = array();
$fh = fopen($arrayfile,'w') or die("Can't open file");
for ($i=1; $i < 8; $i++) { // last seven days
$date = date("Y-m-d",strtotime("-$i days"));
$recent = $f->interestingness_getList($date,array("license,media"),500,1 );
foreach ($recent['photo'] as $photo) {
$license = $photo['license'];
$media = $photo['media'];
/*
* Here's the important bit. The modulus (%) 3
* gets rid of #3 and #6 - the ones that are no-derivs
* according to this list:
* http://www.flickr.com/services/api/flickr.photos.licenses.getInfo.html
*/
if ((($license % 3) != 0) and ($media = 'photo'))
{
$thisPhoto = "";
$thisPhoto .= "
" . "";
$thisPhoto .= "all sizes";
$totalPhotos = array_push ($allPhotos, $thisPhoto);
fwrite($fh,"$thisPhoto\n");
} // if statement
} // foreach loop
} // for loop
fclose($fh);
// one random photo
echo $allPhotos[array_rand($allPhotos)];
?>