File size: 10,886 Bytes
bcb6713 c8804e9 bcb6713 c8804e9 bcb6713 c8804e9 bcb6713 c8804e9 bcb6713 c8804e9 bcb6713 c8804e9 bcb6713 c8804e9 bcb6713 c8804e9 bcb6713 c8804e9 bcb6713 c8804e9 bcb6713 c8804e9 bcb6713 c8804e9 c691646 c8804e9 bcb6713 c8804e9 bcb6713 c8804e9 bcb6713 c8804e9 bcb6713 c8804e9 bcb6713 c8804e9 c691646 c8804e9 bcb6713 c8804e9 bcb6713 c8804e9 bcb6713 c8804e9 | 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 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php echo htmlspecialchars($fileName); ?> - Shared File</title>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Roboto', sans-serif;
background: #202124;
color: #e8eaed;
min-height: 100vh;
display: flex;
flex-direction: column;
}
.header {
background: #292a2d;
padding: 16px 24px;
display: flex;
align-items: center;
justify-content: space-between;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.header-left {
display: flex;
align-items: center;
gap: 16px;
}
.file-icon {
width: 40px;
height: 40px;
background: #3c4043;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
}
.file-icon .material-icons {
font-size: 24px;
color: #8ab4f8;
}
.file-info h1 {
font-size: 20px;
font-weight: 500;
color: #e8eaed;
margin-bottom: 4px;
}
.file-meta {
font-size: 13px;
color: #9aa0a6;
}
.header-actions {
display: flex;
gap: 12px;
}
.btn {
padding: 10px 24px;
border-radius: 4px;
border: none;
cursor: pointer;
font-size: 14px;
font-weight: 500;
display: flex;
align-items: center;
gap: 8px;
transition: all 0.2s;
}
.btn-primary {
background: #8ab4f8;
color: #202124;
}
.btn-primary:hover {
background: #aecbfa;
}
.btn-secondary {
background: #3c4043;
color: #e8eaed;
}
.btn-secondary:hover {
background: #5f6368;
}
.viewer-container {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
padding: 24px;
background: #17181a;
}
.viewer-content {
max-width: 1200px;
width: 100%;
background: #292a2d;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}
.preview-area {
background: #000;
min-height: 500px;
display: flex;
align-items: center;
justify-content: center;
position: relative;
}
.preview-area img {
max-width: 100%;
max-height: 80vh;
object-fit: contain;
}
.preview-area video {
width: 100%;
max-height: 80vh;
background: #000;
}
.preview-area iframe {
width: 100%;
height: 80vh;
border: none;
}
.no-preview {
text-align: center;
padding: 60px 20px;
color: #9aa0a6;
}
.no-preview .material-icons {
font-size: 80px;
margin-bottom: 16px;
opacity: 0.5;
}
.no-preview h2 {
font-size: 24px;
margin-bottom: 8px;
color: #e8eaed;
}
.no-preview p {
font-size: 14px;
margin-bottom: 24px;
}
.file-details {
padding: 24px;
border-top: 1px solid #3c4043;
}
.detail-row {
display: flex;
justify-content: space-between;
padding: 12px 0;
border-bottom: 1px solid #3c4043;
}
.detail-row:last-child {
border-bottom: none;
}
.detail-label {
color: #9aa0a6;
font-size: 14px;
}
.detail-value {
color: #e8eaed;
font-size: 14px;
font-weight: 500;
}
.play-button {
width: 80px;
height: 80px;
background: rgba(138, 180, 248, 0.9);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.3s;
}
.play-button:hover {
background: rgba(174, 203, 250, 0.9);
transform: scale(1.1);
}
.play-button .material-icons {
font-size: 48px;
color: #202124;
}
@media (max-width: 768px) {
.header {
flex-direction: column;
gap: 16px;
}
.header-actions {
width: 100%;
}
.btn {
flex: 1;
justify-content: center;
}
.preview-area {
min-height: 300px;
}
}
</style>
</head>
<body>
<div class="header">
<div class="header-left">
<div class="file-icon">
<span class="material-icons">insert_drive_file</span>
</div>
<div class="file-info">
<h1><?php echo htmlspecialchars($fileName); ?></h1>
<div class="file-meta">
<?php echo formatFileSize($fileSize); ?> •
Shared by Drive
</div>
</div>
</div>
<div class="header-actions">
<a href="<?php echo htmlspecialchars($filePath); ?>" download="<?php echo htmlspecialchars($fileName); ?>" class="btn btn-primary">
<span class="material-icons">download</span>
Download
</a>
</div>
</div>
<div class="viewer-container">
<div class="viewer-content">
<div class="preview-area">
<?php if (strpos($mimeType, 'image/') === 0): ?>
<!-- Image Preview -->
<img src="<?php echo htmlspecialchars($filePath); ?>" alt="<?php echo htmlspecialchars($fileName); ?>">
<?php elseif (strpos($mimeType, 'video/') === 0): ?>
<!-- Video Preview -->
<video controls autoplay>
<source src="<?php echo htmlspecialchars($filePath); ?>" type="<?php echo htmlspecialchars($mimeType); ?>">
Your browser does not support the video tag.
</video>
<?php elseif (strpos($mimeType, 'audio/') === 0): ?>
<!-- Audio Preview -->
<div class="no-preview">
<span class="material-icons">music_note</span>
<h2>Audio File</h2>
<audio controls autoplay style="margin-top: 24px;">
<source src="<?php echo htmlspecialchars($filePath); ?>" type="<?php echo htmlspecialchars($mimeType); ?>">
</audio>
</div>
<?php elseif ($mimeType === 'application/pdf'): ?>
<!-- PDF Preview -->
<iframe src="<?php echo htmlspecialchars($filePath); ?>#toolbar=1"></iframe>
<?php elseif (strpos($mimeType, 'text/') === 0): ?>
<!-- Text Preview -->
<div style="width: 100%; height: 600px; overflow: auto; padding: 24px; background: #1e1e1e; color: #d4d4d4; font-family: 'Courier New', monospace;">
<pre><?php echo htmlspecialchars(file_get_contents($filePath)); ?></pre>
</div>
<?php else: ?>
<!-- No Preview Available -->
<div class="no-preview">
<span class="material-icons">insert_drive_file</span>
<h2>No preview available</h2>
<p>This file type cannot be previewed.</p>
<a href="<?php echo htmlspecialchars($filePath); ?>" download="<?php echo htmlspecialchars($fileName); ?>" class="btn btn-primary">
<span class="material-icons">download</span>
Download to view
</a>
</div>
<?php endif; ?>
</div>
<div class="file-details">
<div class="detail-row">
<span class="detail-label">File name</span>
<span class="detail-value"><?php echo htmlspecialchars($fileName); ?></span>
</div>
<div class="detail-row">
<span class="detail-label">Type</span>
<span class="detail-value"><?php echo htmlspecialchars($mimeType); ?></span>
</div>
<div class="detail-row">
<span class="detail-label">Size</span>
<span class="detail-value"><?php echo formatFileSize($fileSize); ?></span>
</div>
<div class="detail-row">
<span class="detail-label">Modified</span>
<span class="detail-value"><?php echo date('M d, Y', $modifiedTime); ?></span>
</div>
</div>
</div>
</div>
<script>
// Handle video play button if needed
document.addEventListener('DOMContentLoaded', function() {
const video = document.querySelector('video');
if (video) {
video.addEventListener('loadedmetadata', function() {
console.log('Video loaded successfully');
});
}
});
</script>
</body>
</html>
<?php
// Define formatFileSize here if it doesn't exist
if (!function_exists('formatFileSize')) {
function formatFileSize($bytes) {
if ($bytes >= 1073741824) {
return number_format($bytes / 1073741824, 2) . ' GB';
} elseif ($bytes >= 1048576) {
return number_format($bytes / 1048576, 2) . ' MB';
} elseif ($bytes >= 1024) {
return number_format($bytes / 1024, 2) . ' KB';
} else {
return $bytes . ' bytes';
}
}
}
?> |