-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptimize.php
More file actions
33 lines (26 loc) · 980 Bytes
/
optimize.php
File metadata and controls
33 lines (26 loc) · 980 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
<?php
require 'upload_helper.php';
// File upload configuration
$targetDir = "uploads/";
$allowTypes = array('jpg','png','jpeg','gif');
foreach ( changeArrayStructure($_FILES['files']) as $key => $value) {
// echo '<pre>';
// print_r($_POST);
// echo '</pre>';
echo img_resize($files=$value,$maxDim=$_POST['width'],$path_destination=$targetDir)=='error' ? 'false' : 'true' .' <br>';
}
// change array structure
function changeArrayStructure($files) {
$filesMod = array();
for ($i=0; $i < count($files['name']) ; $i++) {
$filesMod[] = array(
'name' => $files['name'][$i],
'type' => $files['type'][$i],
'tmp_name' => $files['tmp_name'][$i],
'error' => $files['error'][$i],
'size' => $files['size'][$i],
);
}
return $filesMod;
}
header("location:index.php?q=1");