-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmovie.php
59 lines (36 loc) · 1.28 KB
/
movie.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
$game_id = (int) $_GET['game'];
include (dirname(__FILE__).'/../../inc.conf.php');
include (dirname(__FILE__).'/../../inhalt/inc.hilfsfunktionen.php');
open_db();
$zeiger = @mysql_query("SELECT phase FROM skrupel_spiele WHERE phase = 1 AND id = $game_id LIMIT 1");
if (@mysql_num_rows($zeiger) == 1) {
$moviegif_files_path = dirname(__FILE__).'/files/moviegif/';
$movie_file = $moviegif_files_path . 'movies/moviegif_' . $game_id . '.gif';
if (!@file_exists($movie_file)) {
@file_put_contents($movie_file, '');
$scenes_dir = $moviegif_files_path . 'temp/' . $game_id . '/';
foreach (scandir($scenes_dir) as $object) {
if ($object[0] != '.') {
$scenes[] = $scenes_dir . $object;
$scenes_dur[] = 120;
}
}
sort($scenes);
// create
include 'gifencoder.class.php';
$gif = new GifEncoder($scenes, $scenes_dur, 0, 2, 255, 0, 0, 'url');
@file_put_contents($movie_file, $gif->getAnimation());
@chmod($movie_file, 0777);
// cleanup
foreach ($scenes as $scene) {
unlink($scene);
}
rmdir($scenes_dir);
}
// output
header('Content-Type: image/gif');
echo @file_get_contents($movie_file);
}
@mysql_close($conn);
?>