Skip to content

Commit 2ff0b3a

Browse files
authored
Image thumbnail add
1 parent 27454a2 commit 2ff0b3a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

index.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
88
<link rel="stylesheet" href="dropzone/dropzone.css" type="text/css">
99
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
10+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.1.20/jquery.fancybox.min.css" type="text/css">
1011
<!-- Place this tag in your head or just before your close body tag. -->
1112
<script async defer src="https://buttons.github.io/buttons.js"></script>
1213
</head>
@@ -15,6 +16,7 @@
1516
//deleteing images
1617
if(isset($_REQUEST['img']) and $_REQUEST['img']!=""){
1718
@unlink('uploads/'.$_REQUEST['img']);
19+
@unlink('uploads/thumb/'.$_REQUEST['img']);
1820
$msg = '<div class="alert alert-success">Image delete successfully.</div>';
1921
}
2022
?>
@@ -29,7 +31,7 @@
2931
<!-- Place this tag where you want the button to render. -->
3032
<a class="github-button" href="https://github.com/learncodeweb" data-style="mega" data-show-count="true" aria-label="Follow @learncodeweb on GitHub">Follow @LCW</a>
3133
<!-- Place this tag where you want the button to render. -->
32-
<a class="github-button" href="https://github.com/learncodeweb/Dropzone-with-Image-Resizer" data-icon="octicon-star" data-style="mega" data-show-count="true" aria-label="Star learncodeweb/Dropzone-with-Image-Resizer on GitHub">Star</a>
34+
<a class="github-button" href="https://github.com/learncodeweb/Dropzone-with-PHP-Image-Resizer" data-icon="octicon-star" data-style="mega" data-show-count="true" aria-label="Star learncodeweb/Dropzone-with-PHP-Image-Resizer on GitHub">Star</a>
3335
<div id="msg"><?php echo isset($msg)?$msg:''; ?></div>
3436
<div class="card">
3537
<div class="card-header"><i class="glyphicon glyphicon-upload"></i> Upload Multiple Files</div>
@@ -60,12 +62,12 @@
6062
<div class="card-body" style="overflow-y: scroll">
6163
<div class="card-columns">
6264
<?php
63-
$directory = 'uploads';
65+
$directory = 'uploads/thumb';
6466
$scanned_directory = array_diff(scandir($directory), array('..', '.'));
6567
foreach($scanned_directory as $img){
6668
?>
6769
<div class="card">
68-
<img src="uploads/<?php echo $img; ?>" alt="<?php echo $img; ?>">
70+
<a href="uploads/<?php echo $img; ?>" data-fancybox="true"> <img src="uploads/thumb/<?php echo $img; ?>" alt="<?php echo $img; ?>" class="img-thumbnail"></a>
6971
<div class="card-body">
7072
<a href="index.php?img=<?php echo $img; ?>" class="btn btn-block btn-danger"><i class="fa fa-trash"></i></a>
7173
</div>
@@ -81,6 +83,7 @@
8183
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
8284
<!--Only these JS files are necessary-->
8385
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
86+
<script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.1.20/jquery.fancybox.min.js"></script>
8487
<script src="dropzone/dropzone.js"></script>
8588
<script>
8689
//Dropzone script
@@ -92,7 +95,7 @@
9295
uploadMultiple: true,
9396
autoProcessQueue: false,
9497
parallelUploads: 50,
95-
maxFilesize: 2, // MB
98+
maxFilesize: 30, // MB
9699
acceptedFiles: ".png, .jpeg, .jpg, .gif",
97100
url: "ajax/actions.ajax.php",
98101
});

0 commit comments

Comments
 (0)