blob: 7f2c258753d545412f7365f427b3b8058b435c81 (
plain)
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
|
<?php // Editor page: capture or upload an image, pick an overlay, preview, and save as a post.?>
<div class="editor-page">
<h1>Create a post</h1>
<?php include __DIR__ . '/../partials/flash.php'; ?>
<input type="hidden" id="csrf-token" value="<?= htmlspecialchars(\App\Csrf::generate()) ?>">
<div class="editor-layout">
<div class="editor-source">
<div class="source-tabs">
<button id="tab-webcam" class="tab active">Webcam</button>
<button id="tab-upload" class="tab">Upload</button>
</div>
<div id="webcam-panel">
<video id="webcam-video" autoplay playsinline></video>
<button id="btn-capture" class="btn">Take photo</button>
</div>
<div id="upload-panel" hidden>
<input type="file" id="file-input" accept="image/jpeg,image/png">
</div>
</div>
<div class="editor-preview">
<canvas id="preview-canvas" width="640" height="640"></canvas>
<div class="overlay-controls">
<label for="overlay-scale">Overlay size</label>
<input type="range" id="overlay-scale" min="10" max="200" value="100">
</div>
<h2>Overlays</h2>
<?php if (empty($overlays)): ?>
<p class="hint">No overlays available.</p>
<?php else: ?>
<div class="overlay-grid">
<?php foreach ($overlays as $overlay): ?>
<img src="<?= htmlspecialchars($overlay) ?>"
class="overlay-thumb"
alt="overlay"
data-filename="<?= htmlspecialchars(basename($overlay)) ?>">
<?php endforeach; ?>
</div>
<?php endif; ?>
<button id="btn-save" class="btn" disabled>Save post</button>
</div>
</div>
<?php if (!empty($userPosts)): ?>
<h2 class="my-posts-title">My posts</h2>
<div class="my-posts-grid">
<?php foreach ($userPosts as $post): ?>
<div class="my-post">
<img src="/<?= htmlspecialchars($post['image_path']) ?>" alt="My post">
<form method="POST" action="/editor/delete/<?= $post['id'] ?>" class="delete-form">
<?= \App\Csrf::field() ?>
<button type="submit" class="btn-delete" onclick="return confirm('Delete this post?')">Delete</button>
</form>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
|