-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathfile_thumb.php
More file actions
125 lines (107 loc) · 4.02 KB
/
file_thumb.php
File metadata and controls
125 lines (107 loc) · 4.02 KB
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
<link rel="stylesheet" href="lib/codemirror3.css">
<script src="lib/codemirror.js"></script>
<script src="mode/xml/xml.js"></script>
<script src="mode/javascript/javascript.js"></script>
<script src="mode/css/css.js"></script>
<script src="mode/clike/clike.js"></script>
<script src="php.js"></script>
<link rel="stylesheet" href="theme/default.css">
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
<link rel="stylesheet" href="css/docs.css">
<title>LIBRARY UPLOAD</title>
<h2>GENERATOR MODUL CMS LOKOMEDIA</h2>
KODE FILE LIBRARY : (fungsi_thumb.php)
<?php if ($_POST['jum_file'] > 0){
echo "<textarea id='code_thumb' name='kode_thumb'>
<?php
";
for ($i=1; $i<=$_POST['jml']; $i++){
if ($_POST['type'.$i]=="file"){
if ($_POST['type_file'.$i]=="gambar"){
?>
function UploadFile<?php echo $_POST['label_value'.$i]; ?><?php echo $i; ?>($fupload_name,$ekstensi,$nomor_file){
//direktori gambar
$vdir_upload = "../../../<?php echo $_POST['folder_simpan_file'.$i]; ?>/";
$vfile_upload = $vdir_upload . $fupload_name;
//Simpan gambar dalam ukuran sebenarnya
move_uploaded_file($_FILES["fupload".$nomor_file]["tmp_name"], $vfile_upload);
//identitas file asli
if ($ekstensi=='jpg' OR $ekstensi=='jpeg'){
$dataim_src = imagecreatefromjpeg($vfile_upload);
}
elseif ($ekstensi=='png'){
$dataim_src = imagecreatefrompng($vfile_upload);
}
elseif ($ekstensi=='gif'){
$dataim_src = imagecreatefromgif($vfile_upload);
}
$im_src = $dataim_src;
$src_width = imageSX($im_src);
$src_height = imageSY($im_src);
//Simpan dalam versi small 110 pixel
//Set ukuran gambar hasil perubahan
$dst_width = <?php echo $_POST['resize_width1'.$i]; ?>;
$dst_height = ($dst_width/$src_width)*$src_height;
//proses perubahan ukuran
$im = imagecreatetruecolor($dst_width,$dst_height);
imagecopyresampled($im, $im_src, 0, 0, 0, 0, $dst_width, $dst_height, $src_width, $src_height);
//Simpan gambar
if ($ekstensi=='jpg' OR $ekstensi=='jpeg'){
imagejpeg($im,$vdir_upload . "small_" . $fupload_name);
}
elseif ($ekstensi=='png'){
imagepng($im,$vdir_upload . "small_" . $fupload_name);
}
elseif ($ekstensi=='gif'){
imagegif($im,$vdir_upload . "small_" . $fupload_name);
}
//Simpan dalam versi medium 360 pixel
//Set ukuran gambar hasil perubahan
$dst_width2 = <?php echo $_POST['resize_width2'.$i]; ?>;
$dst_height2 = ($dst_width2/$src_width)*$src_height;
//proses perubahan ukuran
$im2 = imagecreatetruecolor($dst_width2,$dst_height2);
imagecopyresampled($im2, $im_src, 0, 0, 0, 0, $dst_width2, $dst_height2, $src_width, $src_height);
//Simpan gambar
if ($ekstensi=='jpg' OR $ekstensi=='jpeg'){
imagejpeg($im2,$vdir_upload . "medium_" . $fupload_name);
}
elseif ($ekstensi=='png'){
imagepng($im2,$vdir_upload . "medium_" . $fupload_name);
}
elseif ($ekstensi=='gif'){
imagegif($im2,$vdir_upload . "medium_" . $fupload_name);
}
//Hapus gambar di memori komputer
imagedestroy($im_src);
imagedestroy($im);
imagedestroy($im2);
}
<?php
}
elseif ($_POST['type_file'.$i]=="bukan_gambar"){
?>
function UploadFile<?php echo $_POST['label_value'.$i]; ?><?php echo $i; ?>($fupload_name,$ekstensi,$nomor_file){
//direktori banner
$vdir_upload = "../../../<?php echo $_POST['folder_simpan_file'.$i]; ?>/";
$vfile_upload = $vdir_upload . $fupload_name;
//Simpan gambar dalam ukuran sebenarnya
move_uploaded_file($_FILES["fupload".$nomor_file]["tmp_name"], $vfile_upload);
}
<?php
}
}
}
echo "?></textarea><br><br>";
} ?>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code_thumb"), {
lineNumbers: true,
matchBrackets: true,
mode: "application/x-httpd-php",
indentUnit: 8,
indentWithTabs: true,
enterMode: "keep",
tabMode: "shift"
});
</script>