goto-bus-stop / recanalyst

Analyzes Age of Empires 2 recorded game files.
https://goto-bus-stop.github.io/recanalyst/doc/v4.2.0
GNU General Public License v3.0
77 stars 11 forks source link

I must be doing something wrong [continuation] #43

Open arisslavov opened 7 years ago

arisslavov commented 7 years ago

https://github.com/goto-bus-stop/recanalyst/issues/39

Continuing where that left off. I actually posted an answer there but it was probably suppressed as a notification for being in a closed thread (and couldnt find how to re-open it myself - cause i probably cant).

After your reply i tried that. It seems to be throwing a 500 fatal error: mod_fcgid: stderr: PHP Fatal error: Class 'RecAnalyst\RecordedGame' not found in /recanalyst/recanalyst.php on line 14, referer: /recanalyst/index.html

It's on a php 5.6+ host so that's out of the question.

The current code is as follows:

<?php

require 'vendor/autoload.php';

use RecAnalyst\RecordedGame;

$array = array();
$a = __DIR__ . "/games/" . $_FILES["file"]["name"][0];
move_uploaded_file($_FILES["file"]["tmp_name"][0], $a);
$array[] = $_FILES["file"]["name"][0];
foreach ($array as $val) {
    $filename = __DIR__ . '/games/' . $val;
// Read a recorded game from a file path.
    $rec = new RecordedGame($filename);
// Render a map image. Map images are instances of the \Intervention\Image
// library, so you can easily manipulate them.
    $rec->mapImage()
        ->resize(240, 120)
        ->save('minimap.png');
// Display players and their civilizations.
    echo 'Players: ' . "\n";
    foreach ($rec->players() as $player) {
        echo ' * ' . $player->name . ' (' . $player->civName() . ')' . "\n";
    }
    echo 'Minimap saved in minimap.png.' . "\n";
}
arisslavov commented 7 years ago

Of course i could always give you access to our server if you're willing to help a bit more, but i don't mind either way if you're too busy to do that.

goto-bus-stop commented 7 years ago

Sorry for the delay, I haven't had much time for RecAnalyst recently. What does your directory structure look like now? Does your composer.json file contain a recanalyst/recanalyst key in the dependencies?