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

Commit

Permalink
feature(qr): allow to define own URL, make QR help text adjustable
Browse files Browse the repository at this point in the history
Change-Id: I991acda1cfa382799bae3a273d651d95e5ee3d6b
  • Loading branch information
andi34 committed Sep 29, 2021
1 parent d4dc7ec commit 90a4b68
Show file tree
Hide file tree
Showing 13 changed files with 80 additions and 22 deletions.
8 changes: 6 additions & 2 deletions api/qrcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
require_once '../lib/helper.php';

$filename = $_GET['filename'];
$photoboothUrl = getPhotoboothUrl();

if ($config['qr']['append_filename']) {
$url = $config['qr']['url'] . $filename;
} else {
$url = $config['qr']['url'];
}

include '../vendor/phpqrcode/lib/full/qrlib.php';
$url = $photoboothUrl . '/api/download.php?image=' . $filename;
QRcode::png($url, false, QR_ECLEVEL_H, 10);
9 changes: 8 additions & 1 deletion config/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
$config['picture']['thumb_size'] = '540px';
$config['dev']['error_messages'] = true;
$config['dev']['reload_on_error'] = true;
$config['qr']['enabled'] = true;
$config['webserver']['ip'] = NULL;
$config['webserver']['ssid'] = 'Photobooth';
$config['download']['enabled'] = true;
Expand Down Expand Up @@ -203,6 +202,14 @@
$config['textonprint']['linespace'] = '100';


// Q R - C O D E
$config['qr']['enabled'] = true;
$config['qr']['url'] = NULL;
$config['qr']['append_filename'] = true;
$config['qr']['custom_text'] = false;
$config['qr']['text'] = NULL;


// E - M A I L
// Please read https://github.com/andi34/photobooth/wiki/FAQ#ive-trouble-setting-up-e-mail-config-how-do-i-solve-my-problem
//
Expand Down
4 changes: 4 additions & 0 deletions lib/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@
$config['webserver']['ip'] = str_replace($protocol, '', getPhotoboothUrl());
}

if (!isset($config['qr']['url'])) {
$config['qr']['url'] = getPhotoboothUrl() . '/api/download.php?image=';
}

if (file_exists($my_config_file) && !is_writable($my_config_file)) {
die('Abort. Can not write config/my.config.inc.php.');
} elseif (!file_exists($my_config_file) && !is_writable(__DIR__ . '/../config/')) {
Expand Down
41 changes: 35 additions & 6 deletions lib/configsetup.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,6 @@
'name' => 'dev[reload_on_error]',
'value' => $config['dev']['reload_on_error'],
],
'qr_enabled' => [
'view' => 'advanced',
'type' => 'checkbox',
'name' => 'qr[enabled]',
'value' => $config['qr']['enabled'],
],
'webserver_ip' => [
'view' => 'advanced',
'type' => 'input',
Expand Down Expand Up @@ -1228,6 +1222,41 @@
'value' => $config['textonprint']['linespace'],
],
],
'qr' => [
'view' => 'advanced',
'qr_enabled' => [
'view' => 'advanced',
'type' => 'checkbox',
'name' => 'qr[enabled]',
'value' => $config['qr']['enabled'],
],
'qr_url' => [
'view' => 'advanced',
'type' => 'input',
'placeholder' => $defaultConfig['qr']['url'],
'name' => 'qr[url]',
'value' => htmlentities($config['qr']['url']),
],
'qr_append_filename' => [
'view' => 'advanced',
'type' => 'checkbox',
'name' => 'qr[append_filename]',
'value' => $config['qr']['append_filename'],
],
'qr_custom_text' => [
'view' => 'advanced',
'type' => 'checkbox',
'name' => 'qr[custom_text]',
'value' => $config['qr']['custom_text'],
],
'qr_text' => [
'view' => 'advanced',
'type' => 'input',
'placeholder' => $defaultConfig['qr']['text'],
'name' => 'qr[text]',
'value' => htmlentities($config['qr']['text']),
],
],
'mail' => [
'view' => 'basic',
'mail_enabled' => [
Expand Down
4 changes: 2 additions & 2 deletions resources/lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@
"general:picture_preview_before_processing": "Bild laden bevor Filter berechnet werden",
"general:picture_thumb_size": "Thumbnailgröße",
"general:picture_time_to_live": "Bildanzeige nach Aufnahme:",
"general:qr_enabled": "QR-Code aktivieren",
"general:start_screen_subtitle": "Startbildschirm (Untertitel)",
"general:start_screen_subtitle_visible": "Untertitel auf Startbildschirm anzeigen",
"general:start_screen_title": "Startbildschirm (Titel)",
Expand Down Expand Up @@ -258,7 +257,6 @@
"manual:general:picture_preview_before_processing": "Wenn diese Option aktiviert ist, werden Bilder vorgeladen und während der Filterverarbeitung angezeigt.",
"manual:general:picture_thumb_size": "Thumbnail-Größe auswählen: XS = max 360px, S = max 540px, M = max 900px, L = max 1080px, XL = max 1260px",
"manual:general:picture_time_to_live": "Definieren Sie die Zeit in Millisekunden, die Ihr Bild nach der Aufnahme auf dem Ergebnisbildschirm sichtbar ist.",
"manual:general:qr_enabled": "Wenn diese Option aktiviert ist, wird eine QR-Schaltfläche auf dem Ergebnisbildschirm und in der Galerie angezeigt. Der Benutzer kann beim Scannen des QR-Codes ein Bild herunterladen. Wenn Sie über \"localhost\", \"127.0.0.1\" auf Photobooth zugreifen oder Photobooth in einem Unterordner installiert haben, definieren Sie bitte die IP-Adresse des Photobooth-Webservers, damit der QR-Code funktioniert. <p>Beispiel, wenn auf Photobooth direkt zugegriffen werden kann: <code>192.168.0.50</code>.</p> <p>Beispiel, wenn Photobooth in einem Unterordner installiert ist: <code>192.168.0.50/photobooth</code>.</p>",
"manual:general:start_screen_subtitle": "Geben Sie den auf der Startseite sichtbaren Untertitel ein.",
"manual:general:start_screen_subtitle_visible": "Wenn aktiviert, ist der eingegebene Untertitel auf dem Startbildschirm sichtbar.",
"manual:general:start_screen_title": "Geben Sie den auf der Startseite sichtbaren Titel ein.",
Expand Down Expand Up @@ -353,6 +351,7 @@
"manual:print:textonprint_locationx": "X-Koordinaten des Textes beim Drucken von Text auf Ihr Bild.",
"manual:print:textonprint_locationy": "Y-Koordinaten des Textes beim Drucken von Text auf Ihr Bild.",
"manual:print:textonprint_rotation": "Geben Sie einen Wert ein, der als Gradzahl verwendet wird, um die der Text auf dem Bild gedreht wird.",
"manual:qr:qr_enabled": "Wenn diese Option aktiviert ist, wird eine QR-Schaltfläche auf dem Ergebnisbildschirm und in der Galerie angezeigt. Der Benutzer kann beim Scannen des QR-Codes ein Bild herunterladen. Wenn Sie über \"localhost\", \"127.0.0.1\" auf Photobooth zugreifen oder Photobooth in einem Unterordner installiert haben, definieren Sie bitte die IP-Adresse des Photobooth-Webservers, damit der QR-Code funktioniert. <p>Beispiel, wenn auf Photobooth direkt zugegriffen werden kann: <code>192.168.0.50</code>.</p> <p>Beispiel, wenn Photobooth in einem Unterordner installiert ist: <code>192.168.0.50/photobooth</code>.</p>",
"manual:remotebuzzer:remotebuzzer_logfile": "Wenn der Dev-Mode aktiviert ist, schreibt der Server Debug-Information in die Logdatei. Die Logdatei liegt im <code>tmp</code> Verzeichnis und der Dateiname ist <code>io_server.log</code>.",
"manual:remotebuzzer:remotebuzzer_port": "Server TCP Port - Beispiel 14711.",
"manual:reset:reset_button": "Die Konfiguration wird zurückgesetzt. Wenn Sie auch Bilder und / oder die Mail-Adress-Datenbank löschen wollen, aktivieren Sie zuerst die jeweilige Einstellung und speichern die Konfiguration ab. Führen Sie erst nach dem Speichern das Zurücksetzen aus.",
Expand Down Expand Up @@ -451,6 +450,7 @@
"printing": "Druckauftrag gestartet! Bitte warten...",
"processPhoto": "Collage verarbeiten",
"qr": "QR-Code",
"qr:qr_enabled": "QR-Code aktivieren",
"qrHelp": "Um das Bild auf Ihr Handy herunterzuladen, verbinden Sie sich mit dem WLAN:",
"really_delete": "Wirklich nach Ihren Einstellungen zurücksetzen? Dies kann nicht rückgängig gemacht werden!",
"really_delete_image": "wird gelöscht! Dies kann nicht rückgängig gemacht werden! Bild wirklich löschen?",
Expand Down
2 changes: 1 addition & 1 deletion resources/lang/el.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"general:dev_enabled": "Λειτουργία ανάπτυξης",
"general:dev_error_messages": "Εμφάνιση μηνυμάτων σφάλματος",
"general:download_enabled": "Επιτρέψτε τη λήψη",
"general:qr_enabled": "Ενεργοποιήστε τον κωδικό QR",
"general:start_screen_subtitle": "Αρχική οθόνη (υπότιτλος)",
"general:start_screen_title": "Αρχική οθόνη (τίτλος)",
"general:ui_language": "Επιλέξτε γλώσσα",
Expand Down Expand Up @@ -92,6 +91,7 @@
"print:textonprint_rotation": "Περιστροφή κείμενο",
"printing": "Η εργασία εκτύπωσης ξεκίνησε! Παρακαλώ περιμένετε...",
"qr": "QR Κώδικας",
"qr:qr_enabled": "Ενεργοποιήστε τον κωδικό QR",
"reload": "Ανανέωση της σελίδας",
"reset": "απόδοση",
"save": "Ασφαλής",
Expand Down
12 changes: 10 additions & 2 deletions resources/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@
"general:picture_preview_before_processing": "Preload and show image during filter processing",
"general:picture_thumb_size": "Thumbnail size",
"general:picture_time_to_live": "Show image after capture:",
"general:qr_enabled": "Use QR Codes",
"general:start_screen_subtitle": "Start screen (subtitle)",
"general:start_screen_subtitle_visible": "Show subtitle on start screen",
"general:start_screen_title": "Start screen (title)",
Expand Down Expand Up @@ -299,7 +298,6 @@
"manual:general:picture_preview_before_processing": "If enabled, images are preloaded and shown during filter processing.",
"manual:general:picture_thumb_size": "Choose thumbnail size: XS = max 360px, S = max 540px, M = max 900px, L = max 1080px, XL = max 1260px",
"manual:general:picture_time_to_live": "Choose a time between 1 and 90 seconds. Your picture is visible for that time on the result screen after taking it.",
"manual:general:qr_enabled": "If enabled, a QR-Button is visible on the result screen and inside gallery. User can download a picture while scanning the QR-Code. If you're accessing Photobooth via \"localhost\", \"127.0.0.1\" or if you have Photobooth installed inside a subfolder, please define IP address of the Photobooth web server to make the QR-Code working. <p>Example if Photobooth can be accessed directly: <code>192.168.0.50</code>.</p><p>Example if Photobooth is installed inside a subfolder: <code>192.168.0.50/photobooth</code>.</p>",
"manual:general:start_screen_subtitle": "Enter the subtitle visible on startpage.",
"manual:general:start_screen_subtitle_visible": "If enabled, entered subtitle is visible on start screen.",
"manual:general:start_screen_title": "Enter the title visible on startpage.",
Expand Down Expand Up @@ -402,6 +400,11 @@
"manual:print:textonprint_locationx": "X-Coordinates of the text while printing text on your picture.",
"manual:print:textonprint_locationy": "Y-Coordinates of the text while printing text on your picture.",
"manual:print:textonprint_rotation": "Enter a value which is used as degrees the text gets rotated at print.",
"manual:qr:qr_append_filename": "If enabled, the image name will be added to the QR URL.",
"manual:qr:qr_custom_text": "If enabled, own defined help text will be visible below the QR Code.",
"manual:qr:qr_enabled": "If enabled, a QR-Button is visible on the result screen and inside gallery. User can download a picture while scanning the QR-Code. If you're accessing Photobooth via \"localhost\", \"127.0.0.1\" or if you have Photobooth installed inside a subfolder, please define IP address of the Photobooth web server to make the QR-Code working. <p>Example if Photobooth can be accessed directly: <code>192.168.0.50</code>.</p><p>Example if Photobooth is installed inside a subfolder: <code>192.168.0.50/photobooth</code>.</p>",
"manual:qr:qr_text": "Define own help text which will be visible below the QR Code.",
"manual:qr:qr_url": "Define a URL to point at via QR Code.",
"manual:remotebuzzer:remotebuzzer_collagebutton": "For COLLAGE connect the hardware button to GPIO20. Pull GPIO to ground for to trigger. If enabled, long-press on PICTURE button will not trigger collage.",
"manual:remotebuzzer:remotebuzzer_collagetime": "If PICTURE button pressed less than seconds here, a picture is triggered. If pressed more seconds than here, a collage is triggered. Only works if collage is enabled in the admin settings and the collage button is disbaled.",
"manual:remotebuzzer:remotebuzzer_debounce": "Debounce time for hardware buttons [ms]",
Expand Down Expand Up @@ -524,6 +527,11 @@
"printing": "Started printing! Please wait...",
"processPhoto": "Process Collage",
"qr": "QR Code",
"qr:qr_append_filename": "Append filename to URL",
"qr:qr_custom_text": "Use own help text on QR",
"qr:qr_enabled": "Use QR Codes",
"qr:qr_text": "Own help text",
"qr:qr_url": "URL for QR Code",
"qrHelp": "To download the picture to your smartphone, connect to the WiFi:",
"really_delete": "Really reset according to your settings? This cannot be undone!",
"really_delete_image": "will be deleted! This cannot be undone! Really delete picture?",
Expand Down
4 changes: 2 additions & 2 deletions resources/lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@
"general:picture_preview_before_processing": "Precargar y mostrar la imagen durante el procesamiento del filtro",
"general:picture_thumb_size": "Tamaño de la vista en miniatura",
"general:picture_time_to_live": "Mostrar imagen después de la captura",
"general:qr_enabled": "Utilizar los códigos QR",
"general:start_screen_subtitle": "Página de inicio (Subtítulo)",
"general:start_screen_title": "Página de inicio (Título)",
"general:ui_language": "Elija el idioma",
Expand Down Expand Up @@ -195,7 +194,6 @@
"manual:general:picture_preview_before_processing": "Si está habilitada, las imágenes se precargan y se muestran durante el procesamiento del filtro.",
"manual:general:picture_thumb_size": "Elija el tamaño de la miniatura: XS = max 360px, S = max 540px, M = max 900px, L = max 1080px, XL = max 1260px",
"manual:general:picture_time_to_live": "Introduzca un valor utilizado como milisegundos. Este valor define el tiempo que la imagen es visible en la pantalla de resultados después de tomar una foto.",
"manual:general:qr_enabled": "Si está activado, un botón QR es visible en la pantalla de resultados y dentro de la galería. El usuario puede descargar una imagen mientras escanea el código QR. Si está accediendo a Photobooth a través de \"localhost\", \"127.0.0.1\" o si tiene Photobooth instalado dentro de una subcarpeta, defina la dirección IP del servidor web Photobooth para que el código QR funcione. <p>Por ejemplo, si Photobooth se puede acceder directamente: <code>192.168.0.50</code>.</p><p>Por ejemplo, si Photobooth está instalado dentro de una subcarpeta: <code>192.168.0.50/photobooth</code>.</p>",
"manual:general:start_screen_subtitle": "Introduzca el subtítulo visible en la página de inicio.",
"manual:general:start_screen_title": "Introduzca el título visible en la página de inicio.",
"manual:general:ui_language": "Elegir el idioma de la interfaz.<p>Si te falta un idioma o gusta ayudar a mejorar las traducciones visita <a href=\"https://github.com/andi34/photobooth/wiki/FAQ#how-to-update-or-add-translations\" target=\"_blank\">\"Cómo actualizar o añadir traducciones?\"</a> dentro de la wiki de Photobooth por instrucciones.</p>",
Expand Down Expand Up @@ -267,6 +265,7 @@
"manual:print:textonprint_linespace": "Introduzca el espacio de línea usado mientras imprime texto en la imagen.",
"manual:print:textonprint_locationx": "Coordenadas X del texto mientras imprime texto en la imagen.",
"manual:print:textonprint_locationy": "Coordenadas Y del texto mientras imprime texto en la imagen.",
"manual:qr:qr_enabled": "Si está activado, un botón QR es visible en la pantalla de resultados y dentro de la galería. El usuario puede descargar una imagen mientras escanea el código QR. Si está accediendo a Photobooth a través de \"localhost\", \"127.0.0.1\" o si tiene Photobooth instalado dentro de una subcarpeta, defina la dirección IP del servidor web Photobooth para que el código QR funcione. <p>Por ejemplo, si Photobooth se puede acceder directamente: <code>192.168.0.50</code>.</p><p>Por ejemplo, si Photobooth está instalado dentro de una subcarpeta: <code>192.168.0.50/photobooth</code>.</p>",
"manual:remotebuzzer:remotebuzzer_port": "Puerto TCP Servidor - ejemplo 14711.",
"manual:reset:reset_remove_config": "Si está habilitado, la configuración personal se elimina al restablecer.",
"manual:reset:reset_remove_images": "Si está habilitado, todas las imágenes se eliminan al restablecer.",
Expand Down Expand Up @@ -342,6 +341,7 @@
"print:textonprint_rotation": "Rotación del texto",
"printing": "¡Impresión! Por favor espera...",
"qr": "Código QR",
"qr:qr_enabled": "Utilizar los códigos QR",
"qrHelp": "Para descargar la imagen en su teléfono inteligente, conéctese al WiFi:",
"really_delete_image": "¡será eliminado! Esto no se puede deshacer! ¿Realmente quier borrar la imagen?",
"reload": "Descargar de nuevo la página.",
Expand Down
2 changes: 1 addition & 1 deletion resources/lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
"general:dev_reload_on_error": "Actualiser automatiquement le Photobooth en cas d'erreur (F5)",
"general:download_enabled": "Autoriser les téléchargements",
"general:download_thumbs": "Utiliser des miniatures pour le téléchargement",
"general:qr_enabled": "Utiliser le QR code",
"general:start_screen_subtitle": "Page d’accueil (Sous-titre)",
"general:start_screen_title": "Page d’accueil (Titre)",
"general:ui_language": "Choisissez la langue",
Expand Down Expand Up @@ -118,6 +117,7 @@
"print:textonprint_locationy": "Coordonnée Y",
"print:textonprint_rotation": "Rotation du texte",
"printing": "I'impression a commencé",
"qr:qr_enabled": "Utiliser le QR code",
"reload": "Recharger la page",
"reset": "Réinitialiser",
"save": "Sauvegarder",
Expand Down
Loading

0 comments on commit 90a4b68

Please sign in to comment.