Skip to content

Commit

Permalink
Diverse Anpassungen und Fehlerbehebungen
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed May 23, 2019
1 parent ae0a681 commit d544ea7
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 22 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ data.txt
.sass-cache
package-lock.json
.htaccess
.htpasswd
config.json
1 change: 0 additions & 1 deletion admin/config.json

This file was deleted.

18 changes: 5 additions & 13 deletions config.inc.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<?php

// WARNING!
// This config gets overwritten by the admin panel if you use it.
// If you want to use only this file, delete the admin/config.json file and do not use the admin panel
// as it writes new config.json files.

$config = array();
$sys['os'] = (DIRECTORY_SEPARATOR == '\\') || (strtolower(substr(PHP_OS, 0, 3)) === 'win') ? 'windows' : 'linux';
$config['dev'] = true;
Expand Down Expand Up @@ -52,17 +57,4 @@
if($filename){
$file = json_decode(file_get_contents($filename),true);
$config = $file;
// foreach($config as $k=>$conf){
// if(is_array($conf)) {
// foreach($conf as $sk => $sc) {
// if(isset($file[$k][$sk]) && !empty($file[$k][$sk])) {
// $config[$k][$sk] = $file[$k][$sk];
// }
// }
// } else {
// if(isset($file[$k]) && !empty($file[$k])) {
// $config[$k] = $file[$k];
// }
// }
// }
}
10 changes: 8 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
<script type="text/javascript">
var isdev = true;
var useVideo = <?php echo ($config['previewFromCam']) ? 'true' : 'false'; ?>;
var imgFolder = <?php echo '"'.$config['folders']['images'].'"'; ?>;
var thumbFolder = <?php echo '"'.$config['folders']['thumbs'].'"'; ?>;
var gallery_newest_first = <?php echo ($config['gallery']['newest_first']) ? 'true' : 'false'; ?>;
</script>
</head>
Expand Down Expand Up @@ -86,8 +88,12 @@
<?php
$imagelist = ($config['gallery']['newest_first'] === true) ? array_reverse($images) : $images;
foreach($imagelist as $image) {
echo '<a href="/images/'.$image.'" data-size="1920x1280">
<img src="/thumbs/'.$image.'" />

$filename_photo = $config['folders']['images'] . DIRECTORY_SEPARATOR . $image;
$filename_thumb = $config['folders']['thumbs'] . DIRECTORY_SEPARATOR . $image;

echo '<a href="'.$filename_photo.'" data-size="1920x1280">
<img src="'.$filename_thumb.'" />
<figure>Caption</figure>
</a>';
}
Expand Down
12 changes: 6 additions & 6 deletions resources/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ var photoBooth = (function () {
public.addImage(result.img);

// Add Image
$('<img src="/images/' + result.img + '" class="original">').load(function () {
$('<img src="/'+imgFolder+'/' + result.img + '" class="original">').load(function () {
$('#result').css({
'background-image': 'url(/images/' + result.img + ')'
'background-image': 'url(/'+imgFolder+'/' + result.img + ')'
});
startPage.fadeOut(400, function () {
resultPage.fadeIn(400, function () {
Expand All @@ -176,7 +176,7 @@ var photoBooth = (function () {
// add image to Gallery
public.addImage = function (image) {
// fixme: set to appendTo, if new images should appear at the end, or to prependTo, if new images should appear at the beginning
var $node = $('<a>').html('<img src="/thumbs/' + image + '" />').data('size', '1920x1280').attr('href', '/images/' + image + '?new=1')
var $node = $('<a>').html('<img src="/'+thumbFolder+'/' + image + '" />').data('size', '1920x1280').attr('href', '/'+imgFolder+'/' + image + '?new=1')
if (gallery_newest_first) {
$node.prependTo($('#galimages'));
} else {
Expand Down Expand Up @@ -220,7 +220,7 @@ var photoBooth = (function () {
} else {
if (!processing) {
public.reset();
if(useVideo){
if(useVideo && navigator.mediaDevices){
navigator.getMedia = (navigator.mediaDevices.getUserMedia || navigator.mediaDevices.webkitGetUserMedia || navigator.mediaDevices.mozGetUserMedia || false);
if(navigator.getMedia) {
navigator.mediaDevices.getUserMedia(webcamConstraints)
Expand Down Expand Up @@ -285,7 +285,7 @@ var photoBooth = (function () {
} else {
pswpQR.empty();
var img = pswp.currItem.src;
img = img.replace('/images/', '');
img = img.replace('/'+imgFolder+'/', '');
$('<img>').attr('src', 'qrcode.php?filename=' + img).appendTo(pswpQR);

pswpQR.addClass('qr-active').fadeIn('fast');
Expand All @@ -295,7 +295,7 @@ var photoBooth = (function () {
$(document).on('click touchstart', '.gal-print', function (e) {
e.preventDefault();
var img = pswp.currItem.src;
img = img.replace('images/', '');
img = img.replace(imgFolder+'/', '');
$.ajax({
url: 'print.php?filename=' + encodeURI(img),
}).done(function (data) {
Expand Down

0 comments on commit d544ea7

Please sign in to comment.