ERROR
Can't update image URL for ". $gamename ." (". $gameid .")
";
+ }
} else {
- echo "
ERROR: Can't update image URL for
". $gamename ." (". $gameid .")";
- echo "
";
+ echo "
ERROR
Not an image.
";
}
}
}
+ function isImage($url)
+ {
+ $params = array('http' => array(
+ 'method' => 'HEAD'
+ ));
+ $ctx = stream_context_create($params);
+ $fp = @fopen($url, 'rb', false, $ctx);
+ if (!$fp)
+ return false; // Problem with url
+
+ $meta = stream_get_meta_data($fp);
+ if ($meta === false)
+ {
+ fclose($fp);
+ return false; // Problem reading data from url
+ }
+
+ $wrapper_data = $meta["wrapper_data"];
+ if(is_array($wrapper_data)){
+ foreach(array_keys($wrapper_data) as $hh){
+ if (substr($wrapper_data[$hh], 0, 19) == "Content-Type: image") // strlen("Content-Type: image") == 19
+ {
+ fclose($fp);
+ return true;
+ }
+ }
+ }
+
+ fclose($fp);
+ return false;
+ }
+
function games_reorder($games,$orderby="last_played_desc") {
function totaltime_asc($a,$b) {
return ($a["game_total_time"] <= $b["game_total_time"]) ? -1 : 1;