Skip to content

Commit

Permalink
Add option to choose a default image filter
Browse files Browse the repository at this point in the history
- Allow to use a filter for all photos by default.

related to #96

Change-Id: I5673e646114e31106c23324871980016c096a030
  • Loading branch information
andi34 committed Oct 22, 2019
1 parent 16a591d commit d702eae
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 31 deletions.
1 change: 1 addition & 0 deletions config/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
$config['collage_cntdwn_time'] = '3'; // control countdown timer between collage pictures
$config['cheese_time'] = '1000'; // control time for cheeeeese!
$config['use_filter'] = true;
$config['default_imagefilter'] = 'plain';
$config['polaroid_effect'] = false;
$config['polaroid_rotation'] = '0';
$config['chroma_keying'] = true;
Expand Down
6 changes: 4 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,10 @@
<div id="mySidenav" class="dragscroll sidenav">
<a href="#" class="closebtn"><i class="fa fa-times"></i></a>

<?php foreach(AVAILABLE_FILTERS as $filter): ?>
<div id="<?=$filter?>" class="filter"><a class="btn btn--small" href="#"><?=$filter?></a></div>
<?php foreach(AVAILABLE_FILTERS as $filter => $name): ?>
<div id="<?=$filter?>" class="filter <?php if($config['default_imagefilter'] === $filter)echo 'activeSidenavBtn'; ?>">
<a class="btn btn--small" href="#"><?=$name?></a>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
Expand Down
9 changes: 9 additions & 0 deletions lib/configsetup.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
require_once(__DIR__ . '/filter.php');

$configsetup = [
'general' => [
'language' => [
Expand Down Expand Up @@ -85,6 +87,13 @@
'name' => 'use_filter',
'value' => $config['use_filter']
],
'default_imagefilter' => [
'type' => 'select',
'name' => 'default_imagefilter',
'placeholder' => 'default_imagefilter',
'options' => AVAILABLE_FILTERS,
'value' => $config['default_imagefilter']
],
'polaroid_effect' => [
'type' => 'checkbox',
'name' => 'polaroid_effect',
Expand Down
52 changes: 26 additions & 26 deletions lib/filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,32 +28,32 @@
define('FILTER_YELLOW', 'yellow');

define('AVAILABLE_FILTERS', [
FILTER_PLAIN,
FILTER_ANTIQUE,
FILTER_AQUA,
FILTER_BLUE,
FILTER_BLUR,
FILTER_COLOR,
FILTER_COOL,
FILTER_EDGE,
FILTER_EMBOSS,
FILTER_EVERGLOW,
FILTER_GRAYSCALE,
FILTER_GREEN,
FILTER_MEAN,
FILTER_NEGATE,
FILTER_PINK,
FILTER_PIXELATE,
FILTER_RED,
FILTER_RETRO,
FILTER_SELECTIVE_BLUR,
FILTER_SEPIA_LIGHT,
FILTER_SEPIA_DARK,
FILTER_SMOOTH,
FILTER_SUMMER,
FILTER_VINTAGE,
FILTER_WASHED,
FILTER_YELLOW,
FILTER_PLAIN => 'None',
FILTER_ANTIQUE => 'Antique',
FILTER_AQUA => 'Aqua',
FILTER_BLUE => 'Blue',
FILTER_BLUR => 'Blur',
FILTER_COLOR => 'Color',
FILTER_COOL => 'Cool',
FILTER_EDGE => 'Edge',
FILTER_EMBOSS => 'Emboss',
FILTER_EVERGLOW => 'Everglow',
FILTER_GRAYSCALE => 'Grayscale',
FILTER_GREEN => 'Green',
FILTER_MEAN => 'Mean',
FILTER_NEGATE => 'Negate',
FILTER_PINK => 'Pink',
FILTER_PIXELATE => 'Pixelate',
FILTER_RED => 'Red',
FILTER_RETRO => 'Retro',
FILTER_SELECTIVE_BLUR => 'Selective blur',
FILTER_SEPIA_LIGHT => 'Sepia-light',
FILTER_SEPIA_DARK => 'Sepia-dark',
FILTER_SMOOTH => 'Smooth',
FILTER_SUMMER => 'Summer',
FILTER_VINTAGE => 'Vintage',
FILTER_WASHED => 'Washed',
FILTER_YELLOW => 'Yellow',
]);

function applyFilter($imgfilter, $sourceResource)
Expand Down
4 changes: 1 addition & 3 deletions resources/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const photoBooth = (function () {
let timeOut,
nextCollageNumber = 0,
currentCollageFile = '',
imgFilter = 'imgPlain';
imgFilter = config.default_imagefilter;

const modal = {
open: function (selector) {
Expand Down Expand Up @@ -610,8 +610,6 @@ const photoBooth = (function () {
});
}

$('#plain').addClass('activeSidenavBtn');

return public;
})();

Expand Down
2 changes: 2 additions & 0 deletions resources/lang/de.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/* exported L10N */
const L10N = {
'general_default_imagefilter': 'Standardbildfilter',
'default_imagefilter': 'Bildfilter auswählen',
'general_collage_cntdwn_time': 'Collage-Countdown Timer in Sekunden',
'continuous_collage': 'Collage ohne Unterbrechung aufnehmen',
'delete': 'Löschen',
Expand Down
2 changes: 2 additions & 0 deletions resources/lang/en.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/* exported L10N */
const L10N = {
'general_default_imagefilter': 'Default image filter',
'default_imagefilter': 'Choose image filter',
'general_collage_cntdwn_time': 'Collage-countdown timer in seconds',
'continuous_collage': 'Take collage without interruption',
'delete': 'Delete',
Expand Down
2 changes: 2 additions & 0 deletions resources/lang/es.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/* exported L10N */
const L10N = {
'general_default_imagefilter': 'Filtro de imagen predeterminado',
'default_imagefilter': 'Elegir filtro de imagen',
'general_collage_cntdwn_time': 'Cuenta regresiva del collage en segundos',
'continuous_collage': 'Toma collage sin interrupción',
'delete': 'Eliminar',
Expand Down
2 changes: 2 additions & 0 deletions resources/lang/fr.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/* exported L10N */
const L10N = {
'general_default_imagefilter': 'Filtre d\'image par défaut',
'default_imagefilter': 'Choisissez le filtre d\'image',
'general_collage_cntdwn_time': 'Montage photo compte à rebours en secondes',
'continuous_collage': 'Prendre un photo montage sans interruption',
'delete': 'Effacer',
Expand Down
2 changes: 2 additions & 0 deletions resources/lang/gr.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/* exported L10N */
const L10N = {
'general_default_imagefilter': 'Προεπιλεγμένο φίλτρο εικόνας',
'default_imagefilter': 'Επιλέξτε φίλτρο εικόνας',
'general_collage_cntdwn_time': 'Χρονοδιακόπτης αντίστροφης μέτρησης φωτογραφιών σε δευτερόλεπτα',
'continuous_collage': 'Εγγραφή κολάζ χωρίς διακοπή',
'delete': 'διαγραφή',
Expand Down

0 comments on commit d702eae

Please sign in to comment.