Skip to content

Commit 8ed143f

Browse files
Merge pull request #220 from andi34/feature/devicecam-fixes
Device cam and styling fixes
2 parents 19780ee + db23778 commit 8ed143f

File tree

5 files changed

+24
-6
lines changed

5 files changed

+24
-6
lines changed

api/admin.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@
9494
$newConfig['login_password'] = NULL;
9595
}
9696

97+
if (!$newConfig['previewFromCam']) {
98+
$newConfig['previewCamTakesPic'] = false;
99+
}
100+
97101
$content = "<?php\n\$config = ". var_export(arrayRecursiveDiff($newConfig, $defaultConfig), true) . ";";
98102

99103
if (file_put_contents($my_config_file, $content)) {

api/takePic.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function takePicture($filename)
1414
$demoFolder . $devImg[array_rand($devImg)],
1515
$filename
1616
);
17-
} elseif ($config['previewCamTakesPic']) {
17+
} elseif ($config['previewFromCam'] && $config['previewCamTakesPic']) {
1818
$data = $_POST['canvasimg'];
1919
list($type, $data) = explode(';', $data);
2020
list(, $data) = explode(',', $data);

index.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,7 @@
126126
<i class="fa fa-cog fa-spin"></i>
127127
</div>
128128

129-
<?php if ($config['previewFromCam']): ?>
130129
<video id="video--view" autoplay playsinline></video>
131-
<?php endif; ?>
132130

133131
<div id="counter">
134132
<canvas id="video--sensor"</canvas>

resources/js/core.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ const photoBooth = (function () {
7171
gallery.find('.gallery__inner').hide();
7272
$('.spinner').hide();
7373
$('.send-mail').hide();
74+
$('#video--view').hide();
75+
$('#video--sensor').hide();
7476
public.resetMailForm();
7577
}
7678

@@ -164,9 +166,18 @@ const photoBooth = (function () {
164166
$('<p>').text(`${nextCollageNumber + 1} / ${config.collage_limit}`).appendTo('.cheese');
165167
}
166168

167-
setTimeout(() => {
168-
public.takePic(photoStyle);
169-
}, config.cheese_time);
169+
if (config.previewFromCam && config.previewCamTakesPic && !public.stream && !config.dev) {
170+
console.log('No preview by device cam available!');
171+
172+
public.errorPic({
173+
error: 'No preview by device cam available!'
174+
});
175+
176+
} else {
177+
setTimeout(() => {
178+
public.takePic(photoStyle);
179+
}, config.cheese_time);
180+
}
170181
}
171182

172183
// take Picture
@@ -247,6 +258,7 @@ const photoBooth = (function () {
247258
$('.spinner').hide();
248259
$('.loading').empty();
249260
$('.cheese').empty();
261+
$('#video--view').hide();
250262
$('#video--sensor').hide();
251263
loader.addClass('error');
252264
$('.loading').append($('<p>').text(L10N.error));

resources/sass/style.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,10 @@ input[type="email"] {
212212
p {
213213
margin: 0 0 0.2em;
214214
}
215+
216+
.btn {
217+
font-size: 0.4em;
218+
}
215219
}
216220

217221
.error {

0 commit comments

Comments
 (0)