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

Collage extensions and fixes #436

Closed
wants to merge 12 commits into from
Closed
12 changes: 11 additions & 1 deletion api/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,22 @@
}

$collageLayout = $newConfig['collage']['layout'];
if ($collageLayout === '1+2' || $collageLayout == '2+1') {
if ($collageLayout === '1+2' || $collageLayout == '2+1' || $collageLayout == '2x3') {
$newConfig['collage']['limit'] = 3;
} else {
$newConfig['collage']['limit'] = 4;
}

//If there is a collage placeholder whithin the correct range (0 < placeholderposition <= collage limit), we need to decrease the collage limit by 1
if ($newConfig['collage']['placeholder']) {
$collagePlaceholderPosition = (int) $newConfig['collage']['placeholderposition'];
if ($collagePlaceholderPosition > 0 && $collagePlaceholderPosition <= $newConfig['collage']['limit']) {
$newConfig['collage']['limit'] = $newConfig['collage']['limit'] - 1;
} else {
$newConfig['collage']['placeholderposition'] = false;
}
}

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

if (file_put_contents($my_config_file, $content)) {
Expand Down
6 changes: 5 additions & 1 deletion config/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@
$config['collage']['cntdwn_time'] = '3';
$config['collage']['continuous'] = true;
$config['collage']['continuous_time'] = '5';
// possible layout values: '2+2', '2+2-2', '1+3', '1+3-2', '3+1', '1+2', '2+1', '2x4', '2x4-2'
// possible layout values: '2+2', '2+2-2', '1+3', '1+3-2', '3+1', '1+2', '2+1', '2x4', '2x4-2', '2x4-3', '2x3'
$config['collage']['layout'] = '2+2-2';
$config['collage']['resolution'] = '300';
$config['collage']['dashedline_color'] = '#000000';
$config['collage']['keep_single_images'] = false;
// specify key id (e.g. 13 is the enter key) to use that key to take a collage (collage key)
Expand All @@ -105,6 +106,9 @@
// possible take_frame values: 'off', 'always', 'once'
$config['collage']['take_frame'] = 'off';
$config['collage']['frame'] = null;
$config['collage']['placeholder'] = false;
$config['collage']['placeholderposition'] = '1';
$config['collage']['placeholderpath'] = 'resources/img/placeholder/01.jpg';
$config['textoncollage']['enabled'] = true;
$config['textoncollage']['line1'] = 'Photobooth';
$config['textoncollage']['line2'] = ' we love';
Expand Down
320 changes: 235 additions & 85 deletions lib/collage.php

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions lib/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@
$config['collage']['frame'] = realpath($basepath . DIRECTORY_SEPARATOR . 'resources/img/frames/frame.png');
}

if (!isset($config['collage']['placeholderpath']) || !testFile($config['collage']['placeholderpath'])) {
$config['collage']['placeholderpath'] = realpath($basepath . DIRECTORY_SEPARATOR . 'resources/img/background/01.png');
}

if (!isset($config['textoncollage']['font']) || !testFile($config['textoncollage']['font'])) {
$config['textoncollage']['font'] = realpath($basepath . DIRECTORY_SEPARATOR . 'resources/fonts/GreatVibes-Regular.ttf');
}
Expand Down
35 changes: 35 additions & 0 deletions lib/configsetup.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -654,9 +654,24 @@
'2+1' => '2+1',
'2x4' => '2x4',
'2x4-2' => '2x4 (2)',
'2x4-3' => '2x4 (3)',
'2x3' => '2x3',
],
'value' => $config['collage']['layout'],
],
'collage_resolution' => [
'view' => 'expert',
'type' => 'select',
'name' => 'collage[resolution]',
'placeholder' => $defaultConfig['collage']['resolution'],
'options' => [
'300' => '300 dpi',
'400' => '400 dpi',
'600' => '600 dpi',
'150' => '150 dpi',
],
'value' => $config['collage']['resolution'],
],
'collage_dashedline_color' => [
'view' => 'advanced',
'type' => 'color',
Expand Down Expand Up @@ -703,6 +718,26 @@
'name' => 'collage[frame]',
'value' => htmlentities($config['collage']['frame']),
],
'collage_placeholder' => [
'view' => 'expert',
'type' => 'checkbox',
'name' => 'collage[placeholder]',
'value' => $config['collage']['placeholder'],
],
'collage_placeholderposition' => [
'view' => 'expert',
'type' => 'number',
'placeholder' => $defaultConfig['collage']['placeholderposition'],
'name' => 'collage[placeholderposition]',
'value' => $config['collage']['placeholderposition'],
],
'collage_placeholderpath' => [
'view' => 'expert',
'type' => 'input',
'placeholder' => $defaultConfig['collage']['placeholderpath'],
'name' => 'collage[placeholderpath]',
'value' => htmlentities($config['collage']['placeholderpath']),
],
'textoncollage_enabled' => [
'view' => 'advanced',
'type' => 'checkbox',
Expand Down
6 changes: 6 additions & 0 deletions resources/lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
"collage:collage_dashedline_color": "Farbe der Trennlinie beim 2x4 Collage-Layout",
"collage:collage_enabled": "Foto-Collage erlauben",
"collage:collage_frame": "Rahmen",
"collage:collage_placeholder": "Vordefiniertes Bild für Collage nutzen",
"collage:collage_placeholderposition": "Position innerhalb der Collage",
"collage:collage_placeholderpath": "Pfad zum vordefinierten Bild",
"collage:collage_keep_single_images": "Einzelne Bilder des Collage zur Galerie hinzufügen",
"collage:collage_key": "Tastencode welcher eine Collage auslöst",
"collage:collage_layout": "Collage Layout wählen:",
Expand Down Expand Up @@ -220,6 +223,9 @@
"manual:collage:collage_continuous_time": "Nehmen Sie Einfluss auf die Zeit, die ein Bild bei der Collage ohne Unterbrechung sichtbar ist, bevor das nächste Bild aufgenommen wird.",
"manual:collage:collage_enabled": "Wenn diese Option aktiviert ist, kann der Benutzer eine Collage aufnehmen. Eine Collage besteht aus 4 Bildern. Optional können Sie eine Collage mit oder ohne Unterbrechung aufnehmen.",
"manual:collage:collage_frame": "Geben Sie den Pfad des Rahmens ein, der nach der Aufnahme auf Ihre Collage angewendet wird.",
"manual:collage:collage_placeholder": "Wenn diese Option aktiviert ist, wird eine Position der Collage durch ein benutzerdefiniertes Bild ersetzt.",
"manual:collage:collage_placeholderposition": "Wählen Sie die Position der Collage, die ersetzt werden soll. Bitte setzen Sie einen Wert zwischen 1 und der maximalen Collagen-Anzahl des gewählten Layouts.",
"manual:collage:collage_placeholderpath": "Geben Sie hier den Pfad zum benutzerdefinierten Bild an. Das Bild muss als .jpg vorliegen.",
"manual:collage:collage_keep_single_images": "Wenn Option aktiviert, werden einzelne Bilder aus dem Collage zur Galerie hinzugefügt. Bitte beachten Sie, dass einzelne Bilder nicht sichtbar sind, wenn Sie auf die Galerie von der Ergebnisseite aus zugreifen!",
"manual:collage:collage_key": "Geben Sie die Keyl-ID an, welche zum Erstellen einer Collage verwendet werden soll (z.B. 13 ist die Eingabetaste). Verwenden Sie beispielsweise <a href=\"https://keycode.info\" target=\"_blank\">https://keycode.info</a>, um die Key-ID herauszufinden.",
"manual:collage:collage_layout": "Wählen Sie zwischen den 2x2 und 2x4 Bilder Layouts für die Collage.",
Expand Down
8 changes: 8 additions & 0 deletions resources/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,13 @@
"collage:collage_dashedline_color": "Cutting line color on 2x4 Collage layouts",
"collage:collage_enabled": "Allow photo collage",
"collage:collage_frame": "Frame",
"collage:collage_placeholder": "Use custom placeholder",
"collage:collage_placeholderposition": "Collage image number to replace",
"collage:collage_placeholderpath": "Placeholder image path",
"collage:collage_keep_single_images": "Add single images from collage to gallery",
"collage:collage_key": "Key code which triggers a collage",
"collage:collage_layout": "Choose collage layout:",
"collage:collage_resolution": "Choose collage resolution:",
"collage:collage_only": "Only allow photo collage",
"collage:collage_take_frame": "Take collage with frame",
"collage:textoncollage_enabled": "Text on collage",
Expand Down Expand Up @@ -220,9 +224,13 @@
"manual:collage:collage_continuous_time": "Controll the time a picture is visible on continuous collage before the next picture is taken.",
"manual:collage:collage_enabled": "If enabled, user can take a collage. A collage consists of 4 pictures. Optional you can take a collage with or without interruption.",
"manual:collage:collage_frame": "Enter the path of the frame which is applied to your collage after taking it.",
"manual:collage:collage_placeholder": "If enabled, the image of the collage at the specified position will be replaced by a custom image from the placeholder path",
"manual:collage:collage_placeholderposition": "Define the collage position which should be replaced by a custom image. Please specify a value between 1 and the maximum collage image number depending on the layout.",
"manual:collage:collage_placeholderpath": "Specify the path to the placeholder image. The image should be a .jpg.",
"manual:collage:collage_keep_single_images": "If enabled, single images from collage will be added to the gallery. Please note that single images are not visible if you access the gallery at the result screen!",
"manual:collage:collage_key": "Specify the key id to use that key to take a collage (e.g. 13 is the enter key). For example use <a href=\"https://keycode.info\" target=\"_blank\">https://keycode.info</a> to find out the key id.",
"manual:collage:collage_layout": "Choose between different collage layouts.",
"manual:collage:collage_resolution": "Chose the resolution of the collage in dpi. Higher values might slow down the collage creation process. 300 dpi is a good default for 4x6in / 10x15cm. Use a higher value for high quality printers.",
"manual:collage:collage_only": "If enabled, only collage can be taken.",
"manual:collage:collage_take_frame": "If enabled, defined frame will be applied to your collage after taking it.",
"manual:collage:textoncollage_enabled": "If enabled, you can add some text onto your collage.",
Expand Down