dougua9328 2012-08-09 03:29
浏览 41

PHP file_put_contents从ManiaPlanet GBX文件中提取缩略图时创建0bytes图像文件

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.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
    • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
    • ¥15 MATLAB中streamslice问题
    • ¥15 如何在炒股软件中,爬到我想看的日k线
    • ¥15 seatunnel 怎么配置Elasticsearch
    • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
    • ¥15 (标签-MATLAB|关键词-多址)
    • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
    • ¥500 52810做蓝牙接受端
    • ¥15 基于PLC的三轴机械手程序