Пример #1
0
function flickr_photo_from_tags($tags)
{
    $photos = flickr_tag_search($tags, 10);
    $photos_count = $photos->getCount();
    //echo "Count: " . $photos_count . "\n";
    if ($photos_count == 0) {
        //TODO: It's here that we add the intelligense
        //TODO: Currently we get too many new tags too fast,
        //TODO: Then just fall back to "art" if that fails.
        //TODO: Move to paintr.php
        $generalised_tags = wordnet_tag_synonims($tags);
        $photos = flickr_tag_search($generalised_tags, 10);
        $photos_count = $photos->getCount();
        if ($photos_count == 0) {
            $photos = flickr_tag_search(array("art"), 10);
            $photos_count = $photos->getCount();
            if ($photos_count == 0) {
                throw new Exception("No photos at flickr match requested tags.");
            }
        }
    }
    return flickr_photo($photos, 1);
}
Пример #2
0
function photo_from_tags($tags)
{
    $photos = flickr_tag_search($tags, 10);
    //echo $photos->get ();
    $photos_count = flickr_match_count($photos);
    echo "Count: " . $photos_count . "\n";
    if ($photos_count == 0) {
        //TODO: It's here that we add the intelligense
        //TODO: Currently we get too many new tags too fast,
        //TODO: Then just fall back to "art" if that fails.
        //TODO: Move to paintr.php
        /*      $generalised_tags = wordnet_tag_synonims ($tags);
              $photos = flickr_tag_search ($generalised_tags, 10);
              $photos_count = $photos->getCount();
              if ($photos_count == 0)
        	{*/
        $photos = flickr_tag_search(array("art"), 10);
        $photos_count = flickr_match_count($photos);
        if ($photos_count == 0) {
            die("Can't match colr tags at flickr.");
        }
        //  }
    }
    return flickr_photo($photos, 0);
}