Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/andi34/photobooth into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
andi34 committed Feb 26, 2020
2 parents f987dc4 + 7071e04 commit ebe2c48
Show file tree
Hide file tree
Showing 35 changed files with 552 additions and 125 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ resources/css/style.css
resources/css/rounded.css
resources/css/login.css
resources/css/chromakeying.css
resources/css/slideshow.css
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ before opening a new issue.

Please take a look at the changelog in our [Photobooth Wiki](https://github.com/andreknieriem/photobooth/wiki/changelog).

### :tada: Donation

If you like my work and like to keep me motivated you can buy me a coconut water
[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.me/andreasblaesius)

### :information_source: Donators Early Access

Donators who donated 5€ or more get early access to new features/options i am adding (please leave a message at donation telling your email address).

### :mortar_board: Tutorial

[Raspberry Pi Weddingphotobooth (german)](https://www.andrerinas.de/tutorials/raspberry-pi-einen-dslr-weddingphotobooth-erstellen.html)
Expand Down
4 changes: 2 additions & 2 deletions admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
</button>

<?php if(isset($_SESSION['auth']) && $_SESSION['auth'] === true): ?>
<p><a href="../logout.php" class="btn btn--tiny btn--flex fa fa-sign-out"><span data-l10n="logout"></span></a></p>
<p><a href="../login/logout.php" class="btn btn--tiny btn--flex fa fa-sign-out"><span data-l10n="logout"></span></a></p>
<?php endif; ?>

<div id="checkVersion">
Expand Down Expand Up @@ -132,7 +132,7 @@
</span>
</button>
<?php else:
header("location: ../login.php");
header("location: ../login");
exit;
endif; ?>
</div>
Expand Down
4 changes: 4 additions & 0 deletions api/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@
$newConfig['login_password'] = NULL;
}

if (!$newConfig['previewFromCam']) {
$newConfig['previewCamTakesPic'] = false;
}

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

if (file_put_contents($my_config_file, $content)) {
Expand Down
43 changes: 37 additions & 6 deletions api/applyEffects.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
$filename_keying = $config['foldersAbs']['keying'] . DIRECTORY_SEPARATOR . $file;
$filename_tmp = $config['foldersAbs']['tmp'] . DIRECTORY_SEPARATOR . $file;
$filename_thumb = $config['foldersAbs']['thumbs'] . DIRECTORY_SEPARATOR . $file;
$frame_path = __DIR__ . DIRECTORY_SEPARATOR .$config['take_frame_path'];

if (isset($_POST['isCollage']) && $_POST['isCollage'] === 'true') {
$collageBasename = substr($filename_tmp, 0, -4);
Expand All @@ -29,11 +30,17 @@
$collageSrcImagePaths[] = $collageBasename . '-' . $i . '.jpg';
}

if (!createCollage($collageSrcImagePaths, $filename_tmp, $config['take_frame'], $config['take_frame_path'])) {
if (!createCollage($collageSrcImagePaths, $filename_tmp, $config['take_frame'], $frame_path)) {
die(json_encode([
'error' => 'Could not create collage'
]));
}

if (!$config['keep_images']) {
foreach ($collageSrcImagePaths as $tmp) {
unlink($tmp);
}
}
}

if (!file_exists($filename_tmp)) {
Expand All @@ -43,6 +50,7 @@
}

$imageResource = imagecreatefromjpeg($filename_tmp);
$imageModified = false;

if (!$imageResource) {
die(json_encode([
Expand All @@ -58,32 +66,33 @@

$image_filter = false;

if (!empty($_POST['filter']) && $_POST['filter'] !== 'imgPlain') {
if (!empty($_POST['filter']) && $_POST['filter'] !== 'plain') {
$image_filter = $_POST['filter'];
}

// apply filter
if ($image_filter) {
applyFilter($image_filter, $imageResource);
$imageModified = true;
}

if ($config['polaroid_effect']) {
$polaroid_rotation = $config['polaroid_rotation'];

$imageResource = effectPolaroid($imageResource, $polaroid_rotation, 200, 200, 200);
$imageModified = true;
}

if ($config['take_frame'] && $_POST['isCollage'] !== 'true') {
$frame = imagecreatefrompng($config['take_frame_path']);
$frame = imagecreatefrompng($frame_path);
$frame = resizePngImage($frame, imagesx($imageResource), imagesy($imageResource));
$x = (imagesx($imageResource)/2) - (imagesx($frame)/2);
$y = (imagesy($imageResource)/2) - (imagesy($frame)/2);
imagecopy($imageResource, $frame, $x, $y, 0, 0, imagesx($frame), imagesy($frame));
$imageModified = true;
}

if ($config['chroma_keying']) {
$chromaCopyResource = resizeImage($imageResource, 1500, 1000);

imagejpeg($chromaCopyResource, $filename_keying, $config['jpeg_quality_chroma']);
imagedestroy($chromaCopyResource);
}
Expand All @@ -94,7 +103,29 @@
imagejpeg($thumbResource, $filename_thumb, $config['jpeg_quality_thumb']);
imagedestroy($thumbResource);

imagejpeg($imageResource, $filename_photo, $config['jpeg_quality_image']);
if ($imageModified || $config['jpeg_quality_image'] >= 0) {
imagejpeg($imageResource, $filename_photo, $config['jpeg_quality_image']);
// preserve jpeg meta data
if ($config['preserve_exif_data'] && $config['exiftool']['cmd']) {
$cmd = sprintf($config['exiftool']['cmd'], $filename_tmp, $filename_photo);
exec($cmd, $output, $returnValue);
if ($returnValue) {
die(json_encode([
'error' => 'exiftool returned with an error code',
'cmd' => $cmd,
'returnValue' => $returnValue,
'output' => $output,
]));
}
}
} else {
copy($filename_tmp, $filename_photo);
}

if (!$config['keep_images']) {
unlink($filename_tmp);
}

imagedestroy($imageResource);

// insert into database
Expand Down
4 changes: 2 additions & 2 deletions api/checkVersion.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php
header('Content-Type: application/json');

$url = 'https://api.github.com/repos/andreknieriem/photobooth/releases/latest';
$url = 'https://api.github.com/repos/andi34/photobooth/releases/latest';

$options = [
'http'=> [
'method' => 'GET',
'header' => "User-Agent: andreknieriem/photobooth\r\n"
'header' => "User-Agent: andi34/photobooth\r\n"
]
];

Expand Down
5 changes: 4 additions & 1 deletion api/download.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<?php
require_once('../lib/config.php');

$image = (isset($_GET['image']) && $_GET['image']) != '' ? $_GET['image'] : false;
if($image) {
$filename_source = $config['folders']['images'] . DIRECTORY_SEPARATOR . $image;

header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="photobooth-'.$image.'"');
echo file_get_contents(__DIR__.'/../data/images/'.$image);
echo file_get_contents(__DIR__.'/../'.$filename_source);
exit;
}
4 changes: 2 additions & 2 deletions api/print.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
}

// text on print variables
$fontpath = $config['font_path'];
$fontpath = __DIR__ . DIRECTORY_SEPARATOR . $config['font_path'];
$fontsize = $config['fontsize'];
$fontlocx = $config['locationx'];
$fontlocy = $config['locationy'];
Expand All @@ -37,7 +37,7 @@
$line3text = $config['textonprint']['line3'];

// print frame
$print_frame = $config['print_frame_path'];
$print_frame = __DIR__ . DIRECTORY_SEPARATOR . $config['print_frame_path'];

// exit with error
if (!file_exists($filename_source)) {
Expand Down
2 changes: 1 addition & 1 deletion api/takePic.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function takePicture($filename)
$demoFolder . $devImg[array_rand($devImg)],
$filename
);
} elseif ($config['previewCamTakesPic']) {
} elseif ($config['previewFromCam'] && $config['previewCamTakesPic']) {
$data = $_POST['canvasimg'];
list($type, $data) = explode(';', $data);
list(, $data) = explode(',', $data);
Expand Down
15 changes: 15 additions & 0 deletions config/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@
$config['cntdwn_time'] = '5'; // control countdown timer
$config['collage_cntdwn_time'] = '3'; // control countdown timer between collage pictures
$config['cheese_time'] = '1000'; // control time for cheeeeese!
$config['keep_images'] = true;
$config['image_preview_before_processing'] = true;
$config['preserve_exif_data'] = false;
$config['use_filter'] = true;
$config['default_imagefilter'] = 'plain';
$config['disabled_filters'] = array();
$config['allow_delete'] = true;
$config['polaroid_effect'] = false;
$config['polaroid_rotation'] = '0';
$config['take_frame'] = false;
Expand All @@ -44,6 +48,7 @@
$config['force_buzzer'] = false;
$config['webserver_ip'] = null;
$config['rounded_corners'] = false;
$config['time_to_live'] = '90000';

// specify key id to use that key to take a picture or collage (e.g. 13 is the enter key)
// use for example https://keycode.info to get the key code
Expand Down Expand Up @@ -107,6 +112,12 @@
$config['show_date'] = false; // only works if file_format_date = true
$config['gallery']['date_format'] = 'd.m.Y - G:i';

// SLIDESHOW
$config['slideshow_refreshTime'] = '60';
$config['slideshow_pictureTime'] = '3000';
$config['slideshow_randomPicture'] = true;
$config['slideshow_use_thumbs'] = false;

// TEXT ON PRINT
$config['is_textonprint'] = false;
$config['textonprint']['line1'] = 'line 1';
Expand Down Expand Up @@ -146,3 +157,7 @@
$config['reset_remove_images'] = true;
$config['reset_remove_mailtxt'] = true;
$config['reset_remove_config'] = true;

// PRESERVE EXIF
$config['exiftool']['cmd'] = null;
$config['exiftool']['msg'] = null;
8 changes: 4 additions & 4 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
</div>

<?php if ($config['show_fork']): ?>
<a href="https://github.com/andreknieriem/photobooth" class="github-fork-ribbon" data-ribbon="Fork me on GitHub">Fork me on GitHub</a>
<a href="https://github.com/andi34/photobooth" class="github-fork-ribbon" data-ribbon="Fork me on GitHub">Fork me on GitHub</a>
<?php endif; ?>

<?php if($config['cups_button']): ?>
Expand Down Expand Up @@ -126,9 +126,7 @@
<i class="fa fa-cog fa-spin"></i>
</div>

<?php if ($config['previewFromCam']): ?>
<video id="video--view" autoplay playsinline></video>
<?php endif; ?>

<div id="counter">
<canvas id="video--sensor"</canvas>
Expand Down Expand Up @@ -171,7 +169,9 @@
<a href="#" class="btn imageFilter"><i class="fa fa-magic"></i> <span data-l10n="selectFilter"></span></a>
<?php endif; ?>

<?php if ($config['allow_delete']): ?>
<a href="#" class="btn deletebtn"><i class="fa fa-trash"></i> <span data-l10n="delete"></span></a>
<?php endif; ?>
</div>

<?php if ($config['use_qr']): ?>
Expand Down Expand Up @@ -215,7 +215,7 @@
<img src="resources/img/spacer.png" alt="adminsettings" ondblclick="adminsettings()" />
</div>
<?php else:
header("location: login.php");
header("location: login");
exit;
endif; ?>
</div>
Expand Down
65 changes: 21 additions & 44 deletions install-raspbian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,16 @@ apt update
apt dist-upgrade -y

info "### Photobooth needs some software to run."
if [ "$1" == "apache" ]; then
apache_webserver
if [ "$1" == "nginx" ]; then
nginx_webserver
elif [ "$1" == "lighttpd" ]; then
lighttpd_webserver
else
nginx_webserver
apache_webserver
fi

info "### Installing common software..."
apt install -y php-gd gphoto2
apt install -y php-gd gphoto2 libimage-exiftool-perl

echo -e "\033[0;33m### Is Photobooth the only website on this system?"
read -p "### Warning: If typing y, the whole /var/www/html folder will be removed! [y/N] " -n 1 -r deleteHtmlFolder
Expand All @@ -164,48 +164,25 @@ else
INSTALLFOLDERPATH="/var/www/html/$INSTALLFOLDER/"
fi

echo -e "\033[0;33m### Do you like to install from git? This will take more"
read -p "### time and is recommended only for brave users. [y/N] " -n 1 -r
echo -e "\033[0m"
if [[ $REPLY =~ ^[Yy]$ ]]
then
info "### Your wish is my command!"

info "### We have to make sure that git is installed."
apt install -y git

info "### Also a packet manager is needed."
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
apt update
apt install -y yarn

info "### Now we are going to install Photobooth."
git clone https://github.com/andreknieriem/photobooth $INSTALLFOLDER
cd $INSTALLFOLDERPATH
LATEST_VERSION=$( git describe --tags `git rev-list --tags --max-count=1` )
info "### We ar installing version $LATEST_VERSION".
git checkout $LATEST_VERSION
git submodule update --init

info "### Get yourself a hot beverage. The following step can take up to 15 minutes."
yarn install
yarn build
else
info "### Downloading the latest build."
info "### Installing my fork from git!"

info "### We have to make sure that git is installed."
apt install -y git

info "### Installing a little helper tool to determine the correct url."
apt install -y jq
info "### Also a packet manager is needed."
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
apt update
apt install -y yarn

info "### Downloading the latest release and extracting it."
curl -s https://api.github.com/repos/andreknieriem/photobooth/releases/latest |
jq '.assets[].browser_download_url | select(endswith(".tar.gz"))' |
xargs curl -L --output /tmp/photobooth-latest.tar.gz
info "### Now we are going to install Photobooth."
git clone https://github.com/andi34/photobooth $INSTALLFOLDER
cd $INSTALLFOLDERPATH
git submodule update --init

mkdir -p $INSTALLFOLDERPATH
tar -xzvf /tmp/photobooth-latest.tar.gz -C $INSTALLFOLDERPATH
cd $INSTALLFOLDERPATH
fi
info "### Get yourself a hot beverage. The following step can take up to 15 minutes."
yarn install
yarn build

info "### Setting permissions."
chown -R www-data:www-data $INSTALLFOLDERPATH
Expand Down Expand Up @@ -249,4 +226,4 @@ if [[ $REPLY =~ ^[Yy]$ ]]
then
info "### Your Raspberry Pi will reboot now."
shutdown -r now
fi
fi
Loading

0 comments on commit ebe2c48

Please sign in to comment.