$id = htmlspecialchars($_GET['url']); $tmdb = new TMDb(TMDB_APIKEY); $person = $tmdb->getPerson($id); ?> <div class="container"> <div style="opacity: 100; margin-left: 100px; margin-top: 0%;" class="person_content"> <div class='title'><?php echo $person['name']; ?> </div> <div class="row-fluid"> <div class="span3"> <? echo "<img src=\"".$tmdb->getImageUrl($person['profile_path'],'profile', 'w185')."\" class=\"person_profile\" width=\"100%\">\n"; echo "<strong>Born:</strong><br />".$person['birthday']." - ".$person['place_of_birth']; if ($person['deathday'] != "") { echo "<br /><strong>Died:</strong><br />".$person['deathday']; } ?> </div> <div class="span9"> <h2>Biography</h2> <p><?php echo nl2br($person['biography']); ?> </p> </div> </div> <p> </p>
/** * Lookup a movie on tmdb by id */ public function fetchTmdbProperties($id, $isImdbId = true) { $tmdb = new TMDb($this->apikey, $this->lookuplanguage); $lookupId = $isImdbId ? 'tt' . $id : $id; try { $movie = $tmdb->getMovie($lookupId); } catch (Exception $e) { return false; } if (!$movie || !is_array($movie)) { return false; } if (isset($movie['status_code']) && $movie['status_code'] > 1) { return false; } $ret = array(); $ret['title'] = $movie['title']; $ret['tmdb_id'] = $movie['id']; $ret['imdb_id'] = str_replace('tt', '', $movie['imdb_id']); $ret['rating'] = $movie['vote_average'] == 0 ? '' : $movie['vote_average']; $ret['plot'] = $movie['overview']; if (isset($movie['tagline'])) { $ret['tagline'] = $movie['tagline']; } if (isset($movie['release_date'])) { $ret['year'] = date("Y", strtotime($movie['release_date'])); } if (isset($movie['genres']) && sizeof($movie['genres']) > 0) { $genres = array(); foreach ($movie['genres'] as $genre) { $genres[] = $genre['name']; } $ret['genre'] = $genres; } if (isset($movie['trailers']) && isset($movie['trailers']['youtube']) && sizeof($movie['trailers']['youtube']) > 0) { foreach ($movie['trailers']['youtube'] as $trailer) { $ret['trailer'] = $trailer['source']; break; } } if (isset($movie['poster_path'])) { $ret['cover'] = $tmdb->getImageUrl($movie['poster_path'], TMDb::IMAGE_POSTER, "w185"); } if (isset($movie['backdrop_path'])) { $ret['backdrop'] = $tmdb->getImageUrl($movie['backdrop_path'], TMDb::IMAGE_BACKDROP, "w300"); } return $ret; }
require_once 'functions.php'; require_once 'config.php'; require_once 'db.php'; require_once 'TMDb-PHP-API/TMDb.php'; if (isloggedin()) { $tmdb = new TMDb(TMDB_APIKEY); $movies = $tmdb->searchMovie($_GET['search_keyword']); if (count($movies['results']) > 0) { for ($i = 0; $i < count($movies['results']); $i++) { $ratedArr[] = $movies["results"][$i]; } echo "<div class='row-fluid'>"; $i = 3; foreach ($ratedArr as $r) { $r['poster_path_w185'] = $tmdb->getImageUrl($r['poster_path'], 'poster', "w185"); $i++; if ($i > 3) { echo "</div><div class='row-fluid'>"; $i = 0; } ?> <div class="item span3"> <a href="import.php?action=importsingle&tmdb_id=<?php echo $r["id"]; ?> "> <img src="<?php echo $r["poster_path_w185"]; ?> " width="100%" alt="" />
<?php include 'TMDb.php'; // Default English language $tmdb = new TMDb('API-key'); // Set-up the class with your own language $tmdb_nl = new TMDb('API-key', 'nl'); // If you want to load the TMDb-config (default FALSE) $tmdb_load_config = new TMDb('API-key', 'en', TRUE); // After initialize the class // First request a token from API $token = $tmdb->getAuthToken(); // Request valid session for that particular user from API $session = $tmdb->getAuthSession(); //Retrieve config with initialisation of the class $tmdb = new TMDb('API-key', 'en', TRUE); //Retrieve (cached) config when the class is already initialised $config = $tmdb->getConfig(); //Retrieve config when the class is already initialised from TMDb (always new request) $config = $tmdb->getConfiguration(); //Filepath retrieved from a method (Backdrop image) $filepath = '/eJhymb0SiOd39L3BDe7aO7iQhQx.jpg'; //Get image URL for the backdrop image in its original size $image_url = $tmdb->getImageUrl($filepath, TMDb::IMAGE_BACKDROP, 'original');
/** * Generate base url for requested image type and size. * * @since 1.0 * * @param string $filepath Filepath to image * @param const $imagetype Image type * @param string $size Valid size for the image * * @return string base url */ public static function get_image_url($filepath = null, $imagetype = null, $size = null) { $tmdb = new TMDb(); $url = $tmdb->getImageUrl($filepath, $imagetype, $size); return $url; }