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 #MATLAB仿真#车辆换道路径规划
    • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
    • ¥15 数据可视化Python
    • ¥15 要给毕业设计添加扫码登录的功能!!有偿
    • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
    • ¥15 微信公众号自制会员卡没有收款渠道啊
    • ¥100 Jenkins自动化部署—悬赏100元
    • ¥15 关于#python#的问题:求帮写python代码
    • ¥20 MATLAB画图图形出现上下震荡的线条
    • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘