recanalyst
recanalyst copied to clipboard
I must be doing something wrong [continuation]
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";
}
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.
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?