-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimageChecker.php
More file actions
45 lines (41 loc) · 879 Bytes
/
imageChecker.php
File metadata and controls
45 lines (41 loc) · 879 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
39
40
41
42
43
44
<?php
// Example of usage the script
// https://yourhost.com/imageChecker?url={image_url} or
// https://yourhost.com/imageChecker?mini=1&url={image_url} to get a miniature of image.
include('imageChecker.class.php');
if (!isset($_GET['url'])) {
http_response_code(403);
exit;
}
$url = strip_tags($_GET['url']);
$ich = new ImageChecker;
if (isset($_GET['mini'])) {
$ich->set_mini(true);
}
$step = -1;
while (!isset($err) && $step < 3) {
$step++;
switch ($step) {
case 0:
if (!$ich->setLink($url)) {
$err = "An error to get the image";
}
break;
case 1:
if (!$ich->FastIdentifyImage()) {
$err = "An error to identify a type";
}
break;
case 2:
if (!$ich->getImage()) {
$err = "File size is too large";
}
break;
}
}
if (isset($err)) {
$ich->createError($err);
exit;
}
$ich->showImage();
?>