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

QR code URL does not consider subfolder installation #204

Closed
jacques42 opened this issue Mar 8, 2021 · 3 comments
Closed

QR code URL does not consider subfolder installation #204

jacques42 opened this issue Mar 8, 2021 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@jacques42
Copy link
Collaborator

Describe the bug

Generating the QR code, the URL assumes that Photobooth always is installed in the /var/html/www folder (document root of the webserver). Installing in a subfolder (i.e. /var/html/www/photobooth) QR code URLs won't work

To Reproduce
Steps to reproduce the behavior:

  1. Install in a subfolder
  2. Go to dev mode, take a picture
  3. Generate QR code
  4. Try URL from QR code

Expected behavior

The URL encoded in the QR code needs to reflect the actual path of Photobooth installation root. File api/qrcode.php

$url = 'http://' . $SERVER_IP . '/api/download.php?image=';

Environment (please complete the following information):

  • OS: iOS, Raspberry Pi
  • Browser : All

Photobooth

  • Did it work before? no
  • Which version of Photobooth are you using? v3 Beta

Additional context

@jacques42 jacques42 added the bug Something isn't working label Mar 8, 2021
@jacques42 jacques42 self-assigned this Mar 8, 2021
@andi34
Copy link
Owner

andi34 commented Mar 8, 2021

$config['webserver']['ip'] = '127.0.0.1/Photobooth';

@andi34
Copy link
Owner

andi34 commented Mar 8, 2021

Or via Webinterface.

Or does it conflict with the remotebuzzer?

@andi34
Copy link
Owner

andi34 commented Mar 8, 2021

Could you try:

<?php
require_once '../lib/config.php';

if (!isset($config['webserver']['ip'])) {
    $SERVER_IP = $_SERVER['HTTP_HOST'];
} else {
    $SERVER_IP = $config['webserver']['ip'];
}

$filename = $_GET['filename'];
$api_path = getrootpath('../api');
include '../vendor/phpqrcode/qrlib.php';
$url = 'http://' . $SERVER_IP . $api_path . '/download.php?image=';
QRcode::png($url . $filename, false, QR_ECLEVEL_H, 10);

andi34 added a commit that referenced this issue Mar 10, 2021
Fixes https: //github.com//issues/204

Change-Id: Id91b03ddb834f4f42b7b2741863567dd59b9f237
@andi34 andi34 closed this as completed in 4987d2a Mar 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants