-
Notifications
You must be signed in to change notification settings - Fork 1
/
foto_new_upload.php
executable file
·143 lines (118 loc) · 4.18 KB
/
foto_new_upload.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?php
session_start();
include('includes/globals.php');
include('includes/kick.php');
$id=intval($_POST['album_id']);
$wi=300;
$he=300;
$seed = '0123456789abcdefghijklmnopqrstuvwxyz';
$hash = sha1(uniqid($seed . mt_rand(), true));
$hash = substr($hash, 0, 10).".jpg";
$sql="SELECT * FROM galeria WHERE album_id=:album_id";
$database->query($sql);
$database->bind(':album_id', $id);
$row_a = $database->single();
$image=UPLOAD_DIR."/".$hash;
if($_FILES['foto']['size'] != 0) {
move_uploaded_file ( $_FILES [ 'foto' ][ 'tmp_name' ], $image);
//html out
include("includes/header.php");
echo ' <body class="page-header-fixed">';
include("includes/head.php");
echo '<!-- BEGIN CONTAINER -->
<div class="page-container">';
include("includes/sidebar.php");
echo '<!-- BEGIN CONTENT -->
<div class="page-content-wrapper">
<div class="page-content">
<!-- BEGIN PAGE HEADER-->
<div class="row">
<div class="col-md-12">
<!-- BEGIN PAGE TITLE & BREADCRUMB-->
<h3 class="page-title">';
echo CMS_TITULO;
echo '</h3>
<ul class="page-breadcrumb breadcrumb">
<li>
<i class="fa fa-picture-o"></i>
<a href="galeria.php">Galería</a>
<i class="fa fa-angle-right"></i>
</li>
<li>
<a href="album_fotos.php?id='.$id.'">'.$row_a['album_name'].'</a>
<i class="fa fa-angle-right"></i>
</li>
<li>
<a>Nueva imágen</a>
</li>
</ul>
<!-- END PAGE TITLE & BREADCRUMB-->
</div>
</div>
<!-- END PAGE HEADER-->
<!-- content -->
<div class="row">
<div class="col-md-12">
<!-- BEGIN SAMPLE TABLE PORTLET-->
<div class="portlet box red">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-th"></i>Recorte de imagen
</div>
</div>
<div class="portlet-body flip-scroll">
<script type="text/javascript">
$(function(){
$(\'#cropbox\').Jcrop({
aspectRatio: '.$wi.'/'.$he.',
onSelect: updateCoords,
boxWidth: 638
});
});
function updateCoords(c)
{
$(\'#x\').val(c.x);
$(\'#y\').val(c.y);
$(\'#w\').val(c.w);
$(\'#h\').val(c.h);
};
function checkCoords()
{
if (parseInt($(\'#w\').val())) return true;
alert(\'Por favor Selecciona un ∑rea de recorte antes de continuar.\');
return false;
};
</script>
<img src="'.$image.'" id="cropbox" class="center" />
<br><br>
<div class="form-actions">
<form action="foto_new_save.php" method="post" onsubmit="return checkCoords();">
<input type="hidden" id="x" name="x" />
<input type="hidden" id="y" name="y" />
<input type="hidden" id="w" name="w" />
<input type="hidden" id="h" name="h" />
<input type="hidden" id="h" name="id" value="'.$id.'" />
<input type="hidden" id="h" name="hash" value="'.$hash.'" />
<input type="hidden" id="h" name="wi" value="'.$wi.'" />
<input type="hidden" id="h" name="he" value="'.$he.'" />
<button type="submit" class="btn blue">Guardar</button>
</form>
</div>
</div>
<!-- END SAMPLE TABLE PORTLET-->
</div>
</div>
<!-- end content -->
</div>
</div>
<!-- END CONTENT -->
</div>
<!-- END CONTAINER -->';
include("includes/footer.php");
//end html out
} else {
header("cache-Control: no-cache, must-revalidate");
header("Location: $redirect" );
exit();
}
?>