Skip to content
This repository was archived by the owner on Aug 27, 2022. It is now read-only.

Commit 3bf7ba7

Browse files
committed
config: adjust keying config
1 parent 71b45ee commit 3bf7ba7

File tree

11 files changed

+42
-42
lines changed

11 files changed

+42
-42
lines changed

api/applyEffects.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
$collage_background = __DIR__ . DIRECTORY_SEPARATOR . $config['collage_background'];
3636
$picture_permissions = $config['picture_permissions'];
3737
$thumb_size = substr($config['thumb_size'], 0, -2);
38-
$chroma_size = substr($config['chroma_size'], 0, -2);
38+
$chroma_size = substr($config['keying']['size'], 0, -2);
3939

4040
if (!isset($_POST['style'])) {
4141
die(
@@ -139,7 +139,7 @@
139139
$imageModified = true;
140140
}
141141

142-
if ($config['chroma_keying'] || $_POST['style'] === 'chroma') {
142+
if ($config['keying']['enabled'] || $_POST['style'] === 'chroma') {
143143
$chromaCopyResource = resizeImage($imageResource, $chroma_size, $chroma_size);
144144
imagejpeg($chromaCopyResource, $filename_keying, $config['jpeg_quality_chroma']);
145145
imagedestroy($chromaCopyResource);
@@ -179,14 +179,14 @@
179179
imagedestroy($imageResource);
180180

181181
// insert into database
182-
if ($_POST['style'] !== 'chroma' || ($_POST['style'] === 'chroma' && $config['live_keying_show_all'] === true)) {
182+
if ($_POST['style'] !== 'chroma' || ($_POST['style'] === 'chroma' && $config['live_keying']['show_all'] === true)) {
183183
appendImageToDB($file);
184184
}
185185

186186
// Change permissions
187187
chmod($filename_photo, octdec($picture_permissions));
188188

189-
if ($_POST['style'] === 'chroma' && $config['live_keying_show_all'] === false) {
189+
if ($_POST['style'] === 'chroma' && $config['live_keying']['show_all'] === false) {
190190
unlink($filename_photo);
191191
unlink($filename_thumb);
192192
}

chromakeying.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767

6868
<div style="padding-top:10px;text-align:center;">
6969
<?php
70-
$dir = $config['keying_background_path'] . DIRECTORY_SEPARATOR;
70+
$dir = $config['keying']['background_path'] . DIRECTORY_SEPARATOR;
7171
$cdir = scandir($dir);
7272
foreach ($cdir as $key => $value) {
7373
if (!in_array($value, array(".","..")) && !is_dir($dir.$value)) {
@@ -103,7 +103,7 @@
103103
<script src="node_modules/whatwg-fetch/dist/fetch.umd.js"></script>
104104
<script type="text/javascript" src="api/config.php"></script>
105105
<script type="text/javascript" src="node_modules/jquery/dist/jquery.min.js"></script>
106-
<?php if ($config['chroma_keying_variant'] === 'marvinj'): ?>
106+
<?php if ($config['keying']['variant'] === 'marvinj'): ?>
107107
<script type="text/javascript" src="node_modules/marvinj/marvinj/release/marvinj-1.0.js"></script>
108108
<?php else:?>
109109
<script type="text/javascript" src="vendor/Seriously/seriously.js"></script>

config/config.inc.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,14 @@
128128

129129

130130
// K E Y I N G
131-
$config['chroma_keying'] = false;
132-
// possible chroma_size values: '1000px', '1500px', '2000px', '2500px'
133-
$config['chroma_size'] = '1500px';
134-
$config['use_live_keying'] = false;
135-
// possible chroma_keying_variant values: 'marvinj', 'seriouslyjs'
136-
$config['chroma_keying_variant'] = 'marvinj';
137-
$config['keying_background_path'] = 'resources/img/background';
138-
$config['live_keying_show_all'] = false;
131+
$config['keying']['enabled'] = false;
132+
// possible size values: '1000px', '1500px', '2000px', '2500px'
133+
$config['keying']['size'] = '1500px';
134+
$config['live_keying']['enabled'] = false;
135+
// possible variant values: 'marvinj', 'seriouslyjs'
136+
$config['keying']['variant'] = 'marvinj';
137+
$config['keying']['background_path'] = 'resources/img/background';
138+
$config['live_keying']['show_all'] = false;
139139

140140

141141
// P R I N T

index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
$galleryIcon = 'fa-th';
1919
}
2020

21-
if ($config['use_live_keying']):
21+
if ($config['live_keying']['enabled']):
2222
header("location: livechroma.php");
2323
endif;
2424
?>

lib/configsetup.inc.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -711,51 +711,51 @@
711711
'chroma_keying' => [
712712
'view' => 'advanced',
713713
'type' => 'checkbox',
714-
'name' => 'chroma_keying',
715-
'value' => $config['chroma_keying'],
714+
'name' => 'keying[enabled]',
715+
'value' => $config['keying']['enabled'],
716716
],
717717
'chroma_size' => [
718718
'view' => 'advanced',
719719
'type' => 'select',
720-
'name' => 'chroma_size',
721-
'placeholder' => $defaultConfig['chroma_size'],
720+
'name' => 'keying[size]',
721+
'placeholder' => $defaultConfig['keying']['size'],
722722
'options' => [
723723
'1000px' => 'S',
724724
'1500px' => 'M',
725725
'2000px' => 'L',
726726
'2500px' => 'XL',
727727
],
728-
'value' => $config['chroma_size'],
728+
'value' => $config['keying']['size'],
729729
],
730730
'use_live_keying' => [
731731
'view' => 'advanced',
732732
'type' => 'checkbox',
733-
'name' => 'use_live_keying',
734-
'value' => $config['use_live_keying'],
733+
'name' => 'live_keying[enabled]',
734+
'value' => $config['live_keying']['enabled'],
735735
],
736736
'chroma_keying_variant' => [
737737
'view' => 'expert',
738738
'type' => 'select',
739-
'name' => 'chroma_keying_variant',
740-
'placeholder' => $defaultConfig['chroma_keying_variant'],
739+
'name' => 'keying[variant]',
740+
'placeholder' => $defaultConfig['keying']['variant'],
741741
'options' => [
742742
'marvinj' => 'MarvinJ',
743743
'seriouslyjs' => 'Seriously.js',
744744
],
745-
'value' => $config['chroma_keying_variant'],
745+
'value' => $config['keying']['variant'],
746746
],
747747
'background_path' => [
748748
'view' => 'expert',
749749
'type' => 'input',
750-
'placeholder' => $defaultConfig['keying_background_path'],
751-
'name' => 'keying_background_path',
752-
'value' => htmlentities($config['keying_background_path']),
750+
'placeholder' => $defaultConfig['keying']['background_path'],
751+
'name' => 'keying[background_path]',
752+
'value' => htmlentities($config['keying']['background_path']),
753753
],
754754
'live_keying_show_all' => [
755755
'view' => 'expert',
756756
'type' => 'checkbox',
757-
'name' => 'live_keying_show_all',
758-
'value' => $config['live_keying_show_all'],
757+
'name' => 'live_keying[show_all]',
758+
'value' => $config['live_keying']['show_all'],
759759
],
760760
],
761761
'print' => [

livechroma.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
<body>
4949
<div class="chromawrapper">
5050
<div class="top-bar">
51-
<?php if (!$config['use_live_keying']): ?>
51+
<?php if (!$config['live_keying']['enabled']): ?>
5252
<a href="index.php" class="<?php echo $btnClass1; ?> closebtn"><i class="fa fa-times"></i></a>
5353
<?php endif; ?>
5454

@@ -89,7 +89,7 @@
8989

9090
<div class="backgrounds">
9191
<?php
92-
$dir = $config['keying_background_path'] . DIRECTORY_SEPARATOR;
92+
$dir = $config['keying']['background_path'] . DIRECTORY_SEPARATOR;
9393
$cdir = scandir($dir);
9494
foreach ($cdir as $key => $value) {
9595
if (!in_array($value, array(".","..")) && !is_dir($dir.$value)) {
@@ -142,7 +142,7 @@
142142
<script type="text/javascript" src="vendor/PhotoSwipe/dist/photoswipe-ui-default.min.js"></script>
143143
<script type="text/javascript" src="resources/js/photoinit.js"></script>
144144
<script type="text/javascript" src="resources/js/core.js"></script>
145-
<?php if ($config['chroma_keying_variant'] === 'marvinj'): ?>
145+
<?php if ($config['keying']['variant'] === 'marvinj'): ?>
146146
<script type="text/javascript" src="node_modules/marvinj/marvinj/release/marvinj-1.0.js"></script>
147147
<?php else:?>
148148
<script type="text/javascript" src="vendor/Seriously/seriously.js"></script>

src/js/chromakeying.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function alphaBoundary(imageOut, radius) {
5555
}
5656

5757
function setMainImage(imgSrc) {
58-
if (config.chroma_keying_variant === 'marvinj') {
58+
if (config.keying.variant === 'marvinj') {
5959
const image = new MarvinImage();
6060
image.load(imgSrc, function () {
6161
mainImageWidth = image.getWidth();
@@ -160,7 +160,7 @@ function drawCanvas() {
160160
}
161161

162162
if (typeof mainImage !== 'undefined' && mainImage !== null) {
163-
if (config.chroma_keying_variant === 'marvinj') {
163+
if (config.keying.variant === 'marvinj') {
164164
ctx.drawImage(mainImage, 0, 0);
165165
} else {
166166
//important to fetch tmpimageout

src/js/core.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -578,11 +578,11 @@ const photoBooth = (function () {
578578

579579
// Render Chromaimage after taking
580580
api.renderChroma = function (filename) {
581-
if (config.live_keying_show_all) {
581+
if (config.live_keying.show_all) {
582582
// Add Image to gallery and slider
583583
api.addImage(filename);
584584
}
585-
const imageUrl = config.live_keying_show_all
585+
const imageUrl = config.live_keying.show_all
586586
? config.folders.images + '/' + filename
587587
: config.folders.keying + '/' + filename;
588588
const preloadImage = new Image();

src/js/livechroma.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function alphaBoundary(imageOut, radius) {
5757

5858
// eslint-disable-next-line no-unused-vars
5959
function setMainImage(imgSrc) {
60-
if (config.chroma_keying_variant === 'marvinj') {
60+
if (config.keying.variant === 'marvinj') {
6161
const image = new MarvinImage();
6262
image.load(imgSrc, function () {
6363
mainImageWidth = image.getWidth();
@@ -160,7 +160,7 @@ function drawCanvas() {
160160
}
161161

162162
if (typeof mainImage !== 'undefined' && mainImage !== null) {
163-
if (config.chroma_keying_variant === 'marvinj') {
163+
if (config.keying.variant === 'marvinj') {
164164
ctx.drawImage(mainImage, 0, 0);
165165
} else {
166166
//important to fetch tmpimageout
@@ -208,7 +208,7 @@ function saveImage(cb) {
208208
if (really) {
209209
photoBooth.deleteImage(data.filename, (result) => {
210210
if (result.success) {
211-
if (config.live_keying_show_all) {
211+
if (config.live_keying.show_all) {
212212
photoBooth.deleteImage(photoBooth.chromaimage, (response) => {
213213
if (response.success) {
214214
setTimeout(function () {

src/js/photoinit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ function initPhotoSwipeFromDOM(gallerySelector) {
269269

270270
const img = gallery.currItem.src.split('\\').pop().split('/').pop();
271271

272-
if (config.chroma_keying) {
272+
if (config.keying.enabled) {
273273
location = 'chromakeying.php?filename=' + encodeURI(img);
274274
}
275275
});

0 commit comments

Comments
 (0)