-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathphotoGif.inc.php
54 lines (38 loc) · 1.16 KB
/
photoGif.inc.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
<?php
session_start();
require('connexion.inc.php');
include "assets/gifMaker/GIFEncoder.class.php";
$noExtension = array();
for($x=1;$x<9;$x++){
$imgname = "uploads/original/".$_SESSION['summary'][$x];
$im = @imagecreatefromjpeg($imgname);
$noExtension[$x] = str_replace('.jpg', '', $_SESSION['summary'][$x]);
imagegif($im, "uploads/gifs/".$noExtension[$x].".gif");
$frames[] = "uploads/gifs/".$noExtension[$x].".gif";
$time[] = 15;
}
$gif = new GIFEncoder (
$frames,
$time,
0,
2,
0, 0, 0,
"url"
);
Header ( 'Content-type:image/gif' );
FWrite ( FOpen ( "uploads/gifs/gif_".$noExtension[1].".gif", "wb" ), $gif->GetAnimation() );
for($x=1;$x<9;$x++){
$noExtension[$x] = str_replace('.jpg', '', $_SESSION['summary'][$x]);
@unlink("uploads/gifs/".$noExtension[$x].".gif");
}
$sql = "UPDATE photos SET gif = 'gif_".$noExtension[1].".gif' WHERE neutral = '".$_SESSION['summary'][1]."'";
try {
$req = $connexion->prepare($sql);
$req->execute();
} catch(PDOException $e){
echo 'erreur '.$e->getMessage();
}
echo '<img src="uploads/gifs/gif_'.$noExtension[1].'.gif" />';
session_destroy();
unset($_SESSION);
?>