-
Notifications
You must be signed in to change notification settings - Fork 0
/
resize.php
65 lines (47 loc) · 1.69 KB
/
resize.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
60
61
62
63
64
65
<?php
if($_FILES['upload']['name']) {
include_once("config.php");
$name = $_FILES['upload']['name'];
$tmp_name = $_FILES['upload']['tmp_name'];
$path_info = pathinfo($name);
$extension = $path_info['extension'];
if($extension != "jpg" && $extension != "jpeg" && $extension != "png" && $extension != "gif") {
echo("please upload a jpg, gif, or png");
exit;
}
$uploaded_image_name = "tmp_" . time() . "." . $path_info['extension'];
$uploaded_image = "img/_banners/tmp/" . $uploaded_image_name;
$uploaded_image_abs = ABS_PATH . $uploaded_image;
move_uploaded_file($tmp_name, $uploaded_image_abs);
} else if($_POST['link']) {
include_once("config.php");
$link = $_POST['link'];
$path_info = pathinfo($link);
$extension = $path_info['extension'];
if($extension != "jpg" && $extension != "jpeg" && $extension != "png" && $extension != "gif") {
echo("please upload a jpg, gif, or png");
exit;
}
$uploaded_image_name = "";
$uploaded_image = $link;
$uploaded_image_abs = $link;
} else {
header("Location: upload.php");
}
$page_name = "resize";
include("header.php");
?>
<img src="<?=$uploaded_image?>" id="cropbox" />
<form name="crop_photo" id="crop_photo">
<input type="hidden" name="tmp_name" value="<?=$uploaded_image_name?>" />
<input type="hidden" name="full_path" value="<?=$uploaded_image_abs?>" />
<input type="hidden" id="x" name="x" value="0" />
<input type="hidden" id="y" name="y" value="0" />
<input type="hidden" id="w" name="w" value="<?=BANNER_WIDTH?>" />
<input type="hidden" id="h" name="h" value="<?=BANNER_HEIGHT?>" />
<input type="hidden" name="public" value="<?=$_POST['public']?>" />
<button>crop!</button>
</form>
<?php
include("footer.php");
?>