-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
145 lines (122 loc) · 8.46 KB
/
index.html
File metadata and controls
145 lines (122 loc) · 8.46 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet">
<script type="text/javascript"
src="https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.0/dist/browser-image-compression.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.0/jszip.min.js"
integrity="sha512-xcHCGC5tQ0SHlRX8Anbz6oy/OullASJkEhb4gjkneVpGE3/QGYejf14CUO5n5q5paiHfRFTa9HKgByxzidw2Bw=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/1.3.8/FileSaver.js"></script>
<!-- page title -->
<title>Bulk Image Compress</title>
</head>
<body x-data="imageGallery()" class="bg-white">
<!-- body starts-->
<div class="main">
<div class="container mx-auto px-4 sm:px-8 lg:px-16 xl:px-20">
<!-- hero starts-->
<section class="hero">
<!-- hero headline starts -->
<div class="hero-headline flex flex-col items-center justify-center pt-24 text-center">
<h1 class=" font-bold text-3xl text-gray-900">Browser Based Image Compressor</h1>
</div>
<!-- hero headline ends -->
<!-- dropzone -->
<div class="flex justify-center items-center w-full mt-5">
<label for="dropzone-file"
class="flex flex-col justify-center items-center w-full h-64 bg-gray-50 rounded-lg border-2 border-gray-300 border-dashed cursor-pointer dark:hover:bg-bray-800 dark:bg-gray-700 hover:bg-gray-100 dark:border-gray-600 dark:hover:border-gray-500 dark:hover:bg-gray-600">
<div class="flex flex-col justify-center items-center pt-5 pb-6">
<svg class="mb-3 w-10 h-10 text-gray-400" fill="none" stroke="currentColor"
viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12">
</path>
</svg>
<p class="mb-2 text-sm text-gray-500 dark:text-gray-400"><span class="font-semibold">Click
to upload</span>
or drag and drop</p>
<p class="text-xs text-gray-500 dark:text-gray-400">SVG, PNG, JPG or GIF</p>
</div>
<input id="dropzone-file" type="file" class="hidden" multiple @input="loadImages">
</label>
</div>
<!-- dropzone end -->
<!-- Image grid starts-->
<!-- <section id="photos" class="my-5 grid grid-cols-1 md:grid-cols-2
lg:grid-cols-3 xl:grid-cols-4 gap-4">
<template x-for="image in images" :key="image.id">
<a :href="image.largeImageURL" class="hover:opacity-75 " target="_new">
<img class="w-full h-64 object-cover" :src="image.largeImageURL" :alt="image.tags" />
</a>
</template>
</section> -->
<!-- Image grid ends-->
</section>
<!-- hero ends -->
<!-- config -->
<div class="container mt-6">
<label for="maxSizeMB" class="block mb-2 text-sm font-medium text-gray-900 dark:text-gray-300">Max Size
in MB</label>
<input id="maxSizeMB" type="range" value="1" min="0.01" max="20" step="0.001" class="w-full"
@input="maxSizeMBSetter($event)"
class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700">
<p class="text-sm text-gray-600 dark:text-gray-400" x-text="compressOptions.maxSizeMB"></p>
<label for="maxWidthHeight" class="block mb-2 text-sm font-medium text-gray-900 dark:text-gray-300">Max
Width Height Ratio</label>
<input id="maxWidthHeight" type="range" value="1080" min="0" max="5000" step="10" class="w-full"
@input="maxWidthOrHeightSetter($event)"
class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700">
<p class="text-sm text-gray-600 dark:text-gray-400" x-text="compressOptions.maxWidthOrHeight"></p>
</div>
<!-- config end -->
<!-- progress bar -->
<div id="progress" class="progress-bar mt-6">
<!-- <div class="progress-bar-inner" :style="{ width: compressionState + '%' }"></div> -->
<div class="w-full bg-gray-200 h-1 mb-6">
<div id="progressBar" class="bg-blue-600 h-1" :style="`width: ${compressionState}%`"></div>
</div>
</div>
<!-- Buttons -->
<div class="flex justify-start items-center w-full mt-5">
<button
class="inline-block px-6 py-2.5 bg-blue-600 text-white font-medium text-xs leading-tight uppercase rounded shadow-md hover:bg-blue-700 hover:shadow-lg focus:bg-blue-700 focus:shadow-lg focus:outline-none focus:ring-0 active:bg-blue-800 active:shadow-lg transition duration-150 ease-in-out m-2"
@click="compress()">Compress</button>
<button
class="inline-block px-6 pt-2.5 pb-2 bg-blue-600 text-white font-medium text-xs leading-normal uppercase rounded shadow-md hover:bg-blue-700 hover:shadow-lg focus:bg-blue-700 focus:shadow-lg focus:outline-none focus:ring-0 active:bg-blue-800 active:shadow-lg transition duration-150 ease-in-out flex align-center m-2"
@click="download()">
<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="download" class="w-3 mr-2"
role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<path fill="currentColor"
d="M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z">
</path>
</svg>
Download</button>
<button
class="inline-block px-6 py-2.5 bg-red-600 text-white font-medium text-xs leading-tight uppercase rounded shadow-md hover:bg-red-700 hover:shadow-lg focus:bg-red-700 focus:shadow-lg focus:outline-none focus:ring-0 active:bg-red-800 active:shadow-lg transition duration-150 ease-in-out m-2"
@click="clear()">Clear</button>
</div>
<!-- Buttons end -->
<!-- Footer starts-->
<footer class="p-5 text-sm text-gray-600 flex justify-center items-center">
<span class="text-teal-600 font-semibold">With</span>
<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="heart"
class="svg-inline--fa fa-heart fa-w-16 text-red-600 w-4 h-4 mx-2 align-middle" role="img"
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<path fill="currentColor"
d="M462.3 62.6C407.5 15.9 326 24.3 275.7 76.2L256 96.5l-19.7-20.3C186.1 24.3 104.5 15.9 49.7 62.6c-62.8 53.6-66.1 149.8-9.9 207.9l193.5 199.8c12.5 12.9 32.8 12.9 45.3 0l193.5-199.8c56.3-58.1 53-154.3-9.8-207.9z">
</path>
</svg>
<span class="text-teal-600 font-semibold">From Ankit Mishra </span>
</footer>
<!-- Footer ends -->
</div>
</div>
<!-- body ends-->
<script src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v2.8.2/dist/alpine.min.js"></script>
<script src="/src/main.js"></script>
</body>
</html>