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

Commit a18e8f5

Browse files
authored
applyEffects: fix checking picture frame if enabled
- fix breaking changes from PR #307
1 parent 8b3a09f commit a18e8f5

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

api/applyEffects.php

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,50 +59,54 @@
5959
// Check collage configuration
6060
if ($_POST['style'] === 'collage') {
6161
if ($config['collage']['take_frame'] !== 'off') {
62-
if (is_dir(COLLAGE_FRAME)) {
63-
$errormsg = 'Frame not set! ' . COLLAGE_FRAME . ' is a path but needs to be a png!';
62+
$frame = realpath(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . $config['collage']['frame']);
63+
if (is_dir($frame)) {
64+
$errormsg = 'Frame not set! ' . $frame . ' is a path but needs to be a png!';
6465
logErrorAndDie($errormsg);
6566
}
6667

67-
if (!file_exists(COLLAGE_FRAME)) {
68-
$errormsg = 'Frame ' . COLLAGE_FRAME . ' does not exist!';
68+
if (!file_exists($frame)) {
69+
$errormsg = 'Frame ' . $frame . ' does not exist!';
6970
logErrorAndDie($errormsg);
7071
}
7172
}
7273

7374
if ($config['textoncollage']['enabled']) {
74-
if (is_dir(realpath(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . TEXTONCOLLAGE_FONT))) {
75-
$errormsg = 'Font not set! ' . TEXTONCOLLAGE_FONT . ' is a path but needs to be a ttf!';
75+
$font = realpath(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . $config['textoncollage']['font']);
76+
if (is_dir($font)) {
77+
$errormsg = 'Font not set! ' . $font . ' is a path but needs to be a ttf!';
7678
logErrorAndDie($errormsg);
7779
}
7880

79-
if (!file_exists(realpath(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . TEXTONCOLLAGE_FONT))) {
80-
$errormsg = 'Font ' . TEXTONCOLLAGE_FONT . ' does not exist!';
81+
if (!file_exists($font)) {
82+
$errormsg = 'Font ' . $font . ' does not exist!';
8183
logErrorAndDie($errormsg);
8284
}
8385
}
8486
} else {
8587
// Check picture configuration
8688
if ($config['picture']['take_frame']) {
87-
if (is_dir($picture_frame)) {
88-
$errormsg = 'Frame not set! ' . $picture_frame . ' is a path but needs to be a png!';
89+
$frame = realpath(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . $config['picture']['frame']);
90+
if (is_dir($frame)) {
91+
$errormsg = 'Frame not set! ' . $frame . ' is a path but needs to be a png!';
8992
logErrorAndDie($errormsg);
9093
}
9194

92-
if (!file_exists($picture_frame)) {
93-
$errormsg = 'Frame ' . $picture_frame . ' does not exist!';
95+
if (!file_exists($frame)) {
96+
$errormsg = 'Frame ' . $frame . ' does not exist!';
9497
logErrorAndDie($errormsg);
9598
}
9699
}
97100

98101
if ($config['textonpicture']['enabled']) {
99-
if (is_dir(realpath(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . $fontpath))) {
100-
$errormsg = 'Font not set! ' . $fontpath . ' is a path but needs to be a ttf!';
102+
$font = realpath(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . $fontpath);
103+
if (is_dir($font)) {
104+
$errormsg = 'Font not set! ' . $font . ' is a path but needs to be a ttf!';
101105
logErrorAndDie($errormsg);
102106
}
103107

104-
if (!file_exists(realpath(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . $fontpath))) {
105-
$errormsg = 'Font ' . $fontpath . ' does not exist!';
108+
if (!file_exists($font)) {
109+
$errormsg = 'Font ' . $font . ' does not exist!';
106110
logErrorAndDie($errormsg);
107111
}
108112
}

0 commit comments

Comments
 (0)