-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGetImage.php
More file actions
38 lines (31 loc) · 751 Bytes
/
GetImage.php
File metadata and controls
38 lines (31 loc) · 751 Bytes
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
<?php
require "Config.php";
session_start();
if (isset($_SESSION[$Session_Name])){
if ($_SESSION[$Session_Name] !=='1'){
die;
}
;
} else {
die;
}
;
$IMGRequestName = $_GET[$GetName];
if ($FileType == 'png' & file_exists($IMG_DIR . $IMGRequestName . ".png")){
$IMG = imagecreatefrompng($IMG_DIR . $IMGRequestName . ".png");
header('Content-Type: image/PNG');
imagepng($IMG);
die;
}
elseif ($FileType == 'jpg' & file_exists($IMG_DIR . $IMGRequestName . ".jpg")){
$IMG = imagecreatefromjpeg($IMG_DIR . $IMGRequestName . ".jpg");
header('Content-Type: image/JPEG');
imagejpeg($IMG);
die;
} else {
$IMG = imagecreatefrompng($NotFoundImage);
header('Content-Type: image/PNG');
imagepng($IMG);
}
;
?>