/** * Converts plain cast data into array of actors with thumbnails * * @author Andreas Goetz <*****@*****.**> */ function prepare_cast($cast) { global $config; // convert text represenatation into array $actors = array_filter(preg_split("/\r?\n/", trim($cast))); // reformat roles $actors = preg_replace('/\\((.*?)\\)/', '<small>($1)</small>', $actors); array_walk($actors, 'split_cast_array'); // check for actor thumbnails if ($config['actorpics']) { get_actor_thumbnails_batched($actors); } // loop over actors from full-text field foreach ($actors as $idx => $actor) { $actors[$idx]['imdburl'] = engineGetActorUrl($actor['name'], $actor['id'], engineGetActorEngine($actor['id'])); // check for actor thumbnail # if ($config['actorpics']) $actor['imgurl'] = getActorThumbnail($actor['name'], $actor['id']); } return $actors; }
$smallurl = $m[1] . 'M' . $m[2]; if (cache_file_exists($smallurl, $cache_file, CACHE_IMG, $ext) || download($smallurl, $cache_file)) { copy($cache_file, $file); } } } } } // default - no url given or no image $file = img(); // Get imgurl for the actor if ($name) { require_once './engines/engines.php'; // name given $name = html_entity_decode($name); $result = engineActor($name, $actorid, engineGetActorEngine($actorid)); if (!empty($result)) { $url = $result[0][1]; } if (preg_match('/nohs(-[f|m])?.gif$/', $url)) { // imdb no-image picture $url = ''; } // write only if HTTP lookup physically successful $SQL = 'REPLACE ' . TBL_ACTORS . " (name, imgurl, actorid, checked)\n VALUES ('" . addslashes($name) . "', '" . addslashes($url) . "', '" . addslashes($actorid) . "', NOW())"; runSQL($SQL); } // Get cached image for the given url if (preg_match('/\\.(jpe?g|gif|png)$/i', $url, $matches)) { // calculate cache filename if we're not looking into the cache again- otherwise this is done by cache_file_exists // $file is further needed for downloading the file