Skip to content

Commit

Permalink
Merge pull request #220 from andi34/feature/devicecam-fixes
Browse files Browse the repository at this point in the history
Device cam and styling fixes
  • Loading branch information
andreknieriem authored Feb 28, 2020
2 parents 19780ee + db23778 commit 8ed143f
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 6 deletions.
4 changes: 4 additions & 0 deletions api/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@
$newConfig['login_password'] = NULL;
}

if (!$newConfig['previewFromCam']) {
$newConfig['previewCamTakesPic'] = false;
}

$content = "<?php\n\$config = ". var_export(arrayRecursiveDiff($newConfig, $defaultConfig), true) . ";";

if (file_put_contents($my_config_file, $content)) {
Expand Down
2 changes: 1 addition & 1 deletion api/takePic.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function takePicture($filename)
$demoFolder . $devImg[array_rand($devImg)],
$filename
);
} elseif ($config['previewCamTakesPic']) {
} elseif ($config['previewFromCam'] && $config['previewCamTakesPic']) {
$data = $_POST['canvasimg'];
list($type, $data) = explode(';', $data);
list(, $data) = explode(',', $data);
Expand Down
2 changes: 0 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,7 @@
<i class="fa fa-cog fa-spin"></i>
</div>

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

<div id="counter">
<canvas id="video--sensor"</canvas>
Expand Down
18 changes: 15 additions & 3 deletions resources/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ const photoBooth = (function () {
gallery.find('.gallery__inner').hide();
$('.spinner').hide();
$('.send-mail').hide();
$('#video--view').hide();
$('#video--sensor').hide();
public.resetMailForm();
}

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

setTimeout(() => {
public.takePic(photoStyle);
}, config.cheese_time);
if (config.previewFromCam && config.previewCamTakesPic && !public.stream && !config.dev) {
console.log('No preview by device cam available!');

public.errorPic({
error: 'No preview by device cam available!'
});

} else {
setTimeout(() => {
public.takePic(photoStyle);
}, config.cheese_time);
}
}

// take Picture
Expand Down Expand Up @@ -247,6 +258,7 @@ const photoBooth = (function () {
$('.spinner').hide();
$('.loading').empty();
$('.cheese').empty();
$('#video--view').hide();
$('#video--sensor').hide();
loader.addClass('error');
$('.loading').append($('<p>').text(L10N.error));
Expand Down
4 changes: 4 additions & 0 deletions resources/sass/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@ input[type="email"] {
p {
margin: 0 0 0.2em;
}

.btn {
font-size: 0.4em;
}
}

.error {
Expand Down

0 comments on commit 8ed143f

Please sign in to comment.