Пример #1
0
 private function findPersonImage($page, $person, $org)
 {
     $image_matches = array();
     if (!stristr($org->name, $person->name_last)) {
         if ($images = LsHtml::matchImages($page)) {
             $ct = 0;
             foreach ($images as $image) {
                 if (!stristr($image['url'], 'spacer') && !stristr($image['url'], 'icon') && (preg_match('/' . $person->name_last . '[^\\/]*$/is', $image['url']) || stristr($image['alt'], $person->name_last))) {
                     $image_matches[] = $image;
                     //$this->printDebug('IMAGE MATCH: ' . $image['url'] . ' ' . $image['alt']);
                 } else {
                     //$this->printDebug($image['url']);
                     $ct++;
                 }
             }
             //$this->printDebug($ct . ' images did not match');
         }
     }
     if (count($image_matches) == 1) {
         return $image_matches[0];
     } else {
         return false;
     }
 }