arsort($files); $files = array_keys($files); return $files ? $files : false; } function filesize_formatted($path) { $size = filesize($path); $units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'); $power = $size > 0 ? floor(log($size, 1024)) : 0; return number_format($size / pow(1024, $power), 2, '.', ',') . ' ' . $units[$power]; } $files = t**s($dir); $count = count($files); foreach ($files as $file => $count) { $filedate = date("H:i | d.m.Y", filemtime("./images/{$files[$file]}")); $filedimension = getimagesize("./images/{$files[$file]}"); echo '<div class="trash"><img class="lazy" data-original="./images/' . $files[$file] . '"><p title="' . $files[$file] . ' @ ' . $filedimension[0] . 'x' . $filedimension[1] . ' | ' . filesize_formatted("./images/{$files[$file]}") . '">' . $filedate . '</p></div><p class="ddiv"></p>' . PHP_EOL; } ?> </div> </center> <script src="smoothscroll.min.js"></script> <script src="jquery-2.1.4.min.js"></script> <script src="jquery.lazyload.min.js"></script> <script> $("img.lazy").lazyload(); </script> <script type="text/javascript" src="infi.js"></script> <script type="text/javascript" src="next.js"></script> </body> </html>
function file_size($file) { global $directory; return @filesize_formatted($directory . '/' . $file); }
$rowid = $roomTypeid; } $imgList = ''; $img_short_dir = '/uploadedimages/files/'; $img_dir = '/admin/uploadedimages/files/'; $thumbnail_url = '/admin/uploadedimages/files/thumbnail/'; $img_qry = exec_query_utf8("SELECT * FROM tblphotogallery WHERE cateid={$photoCateid} AND rowid={$rowid} ORDER BY id DESC"); while ($img_row = mysqli_fetch_assoc($img_qry)) { $imgList .= '<tr class="template-download fade in"> <td> <a href="' . $img_dir . $img_row['filename'] . '" title="' . $img_row['filename'] . '" download="' . $img_row['filename'] . '" data-gallery=""> <div style="background:url(' . $thumbnail_url . $img_row['filename'] . ') center center no-repeat; background-size:cover; width:150px; height:150px;"></div> </a> </td> <td><a href="' . $img_dir . $img_row['filename'] . '" title="' . $img_row['filename'] . '" download="' . $img_row['filename'] . '" data-gallery="">' . $img_row['filename'] . '</a></td> <td>' . filesize_formatted('..' . $img_short_dir . $img_row['filename']) . '</td> <td> <button class="btn btn-danger delete" data-type="DELETE" data-url="/admin/uploadedimages/?file=' . $img_row['filename'] . '"> <i class="glyphicon glyphicon-trash"></i> <span>Delete</span> </button> <input type="checkbox" name="delete" value="1" class="toggle"> </td> </tr>'; } echo $imgList; } elseif ($cmd == 'forumTopicList') { $keyword = post("keyword"); $cateid = post('cateid'); $currentPage = intval(post("currentPage")); $rowsPerPage = post("rowsPerPage");
</tr> </thead> <tbody> <?php $s_scandir = scandir($s_patch_i); foreach ($s_scandir as $key => $value_dir) { $s_fpatch = "{$s_patch_i}/{$value_dir}"; if (!is_dir($s_fpatch) || !$value_dir == "." || !$value_dir == "..") { $url_href = "?view="; } else { $url_href = "?cd="; } echo '<tr> <td style="width:24px;">~</td> <td><a href="' . $url_href . $s_fpatch . '">' . $value_dir . '</a></td> <td>' . filesize_formatted($value_dir) . '</td> <td><small>' . date("d F Y H:i:s", filemtime($value_dir)) . '</small></td> <td style="width:10px;">' . perms($s_fpatch) . '</td> <td>'; if (!is_dir($s_fpatch) || !$value_dir == "." || !$value_dir == "..") { ?> <form action="" method="post"> <select name="opsi"> <option value="delete">Hapus</option> <option value="edit">Edit</option> <option value="rename">Rename</option> <option value="download">Download</option> </select> <input type="hidden" name="s_patch_lct" value="<?php echo $s_fpatch; ?>
<?php $filePath = $configDetails['user_files'] . $_SESSION['SesUserId']; if (!file_exists($filePath)) { mkdir($filePath, 0777, true); chmod($filePath, 0777); } $userFiles = array(); $files = scandir($filePath); $k = 0; foreach ($files as $file) { if ($file == '.' || $file == '..') { continue; } else { $userFiles[$k]['file'] = $file; $path_details = pathinfo($filePath . "/" . $file); $userFiles[$k]['filename'] = $path_details['filename']; $userFiles[$k]['extension'] = $path_details['extension']; $userFiles[$k]['file_size'] = filesize_formatted($filePath . "/" . $file); $userFiles[$k]['img'] = getFilePic($filePath . "/" . $file, $path_details['extension']); $k += 1; } } $smarty->assign('filePath', $filePath); $smarty->assign('userfilecnt', count($userFiles)); $smarty->assign('userFiles', $userFiles);