Made this last night. Quite handy and can be integrated with a blog/forum. Postting the function here. Do update if you have an improved code
ATM, the function would search for the TV Show in the TheTVDB database, and if found will return the banner image link uploaded to lulzimg.com
Please do note that the code above considers that the title of the show is in Scene Release format..
Also note, that the postHost function is a simple function which uses curl to post requests to TheTVDB. UTL and AutoUL users have that function in the script.
Ex:
The.Best.Thing.I.Ever.Ate.S03E03.Regional.Favorites.HDTV.XviD-MOMENTUM
Hope that helps.
Regards,
gunda316
ATM, the function would search for the TV Show in the TheTVDB database, and if found will return the banner image link uploaded to lulzimg.com
PHP:
function getBanner($title){
if(preg_match("/[a-zA-Z0-9.]+S[0-9]+E[0-9]+|[A-Za-z0-9.]+20[0-9.]+/", $title, $match)){
$showname = trim(str_replace(".", " ", $match[0]));
$showname = trim(preg_replace("/S[0-9]+E[0-9]+/", "", $showname));
$url = "http://thetvdb.com/api/GetSeries.php?seriesname=".urlencode($showname);
$page = postHost($url);
if(preg_match("/graphical\/[a-z0-9A-Z.\-]+/", $page, $match)){
$img = postHost("http://www.lulzimg.com/upload.php?submit=lulz&url=http://thetvdb.com/banners/$match[0]");
//echo $img;
preg_match_all("/http:\/\/lulzimg.com\/[a-z0-9]+\/[a-z0-9A-Z.]+/", $img, $matches);
$imageUrl = $matches[0][1];
return $imageUrl;
}
}
}
Also note, that the postHost function is a simple function which uses curl to post requests to TheTVDB. UTL and AutoUL users have that function in the script.
Ex:
The.Best.Thing.I.Ever.Ate.S03E03.Regional.Favorites.HDTV.XviD-MOMENTUM
Hope that helps.
Regards,
gunda316