I'm having trouble with extracting a thumbnail from GBX file (ManiaPlanet file).
The main problem is it worked a while ago, but it's not working now. I have changed the code a lot since then.
Here's the code:
<?php
$domain = 'http://bryan1998.dyndns.org';
$ml = 'bryan199813';
include_once('files/gbxdatafetcher.inc.php');
//Filenames
$ext = '.Map.Gbx';
$file = 'TFS_Battle 001';
$filename = $maps_dir . $file . $ext;
//Make simplename
$simplename = str_replace(' ', '_', $file);
$simplename = strtolower($simplename);
$simplename = recode_string("us..flat", $simplename);
//$simplename = preg_replace('/[^(\x20-\x7F)]*/','_', $simplename);
//GBX class
$gbx = new GBXChallengeFetcher($filename, $tnimage, true);
//Extract thumbnail
if (!file_exists($filename)) {
file_put_contents('YourManialink/Content/Thumbnails/Maps/' . $simplename . '.jpg', $gbx->thumbnail);
chmod('YourManialink/Content/Thumbnails/Maps/' . $simplename . '.jpg', 0777);
}
else {}
//Display Manialink
echo '
<frame posn="0 65.5 10">
<quad posn="0 0 0" sizen="34 34 0" halign="center" style="Bgs1" substyle="BgList"/>
<quad posn="0 -1.5 5" sizen="31 31 0" halign="center" image="' . $domain . '/ml/' . $ml . '/YourManialink/Content/Thumbnails/Maps/' . $simplename . '.jpg"/>
</frame>';
?>
Note that the PHP framework I use has some of variables which aren't declared in this file.