-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7e8fc51
commit 9899ed5
Showing
7 changed files
with
94 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace Photobooth\Dto; | ||
|
||
class CollageConfig | ||
{ | ||
public string $collageLayout; | ||
public int $collageResolution; | ||
public string $collageBackgroundColor; | ||
public string $collageFrame; | ||
public string $collageTakeFrame; | ||
public string $collagePlaceholder; | ||
public int $collagePlaceholderPosition; | ||
public string $collagePlaceholderPath; | ||
public string $collageBackground; | ||
public string $collageDashedLineColor; | ||
public int $collageLimit; | ||
public string $pictureFlip; | ||
public int $pictureRotation; | ||
public string $picturePolaroidEffect; | ||
public int $picturePolaroidRotation; | ||
public string $textOnCollageEnabled; | ||
public string $textOnCollageLine1; | ||
public string $textOnCollageLine2; | ||
public string $textOnCollageLine3; | ||
public int $textOnCollageLocationX; | ||
public int $textOnCollageLocationY; | ||
public int $textOnCollageRotation; | ||
public string $textOnCollageFont; | ||
public string $textOnCollageFontColor; | ||
public int $textOnCollageFontSize; | ||
public int $textOnCollageLinespace; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
namespace Photobooth\Factory; | ||
|
||
use Photobooth\Dto\CollageConfig; | ||
use Photobooth\Utility\PathUtility; | ||
|
||
class CollageConfigFactory | ||
{ | ||
public static function fromConfig(array $config): CollageConfig | ||
{ | ||
$collageConfig = new CollageConfig(); | ||
$collageConfig->collageLayout = $config['collage']['layout']; | ||
$collageConfig->collageResolution = (int) substr($config['collage']['resolution'], 0, -3); | ||
$collageConfig->collageBackgroundColor = $config['collage']['background_color']; | ||
$collageConfig->collageFrame = str_starts_with($config['collage']['frame'], 'http') | ||
? $config['collage']['frame'] | ||
: $_SERVER['DOCUMENT_ROOT'] . $config['collage']['frame']; | ||
$collageConfig->collageTakeFrame = $config['collage']['take_frame']; | ||
$collageConfig->collagePlaceholder = $config['collage']['placeholder']; | ||
// If a placeholder is set, decrease the value by 1 in order to reflect array counting at 0 | ||
$collageConfig->collagePlaceholderPosition = (int) $config['collage']['placeholderposition'] - 1; | ||
$collageConfig->collagePlaceholderPath = str_starts_with($config['collage']['placeholderpath'], 'http') | ||
? $config['collage']['placeholderpath'] | ||
: $_SERVER['DOCUMENT_ROOT'] . $config['collage']['placeholderpath']; | ||
$collageConfig->collageBackground = (empty($config['collage']['background']) | ||
? '' | ||
: str_starts_with($config['collage']['background'], 'http')) | ||
? $config['collage']['background'] | ||
: $_SERVER['DOCUMENT_ROOT'] . $config['collage']['background']; | ||
$collageConfig->collageDashedLineColor = $config['collage']['dashedline_color']; | ||
// If a placholder image should be used, we need to increase the limit here in order to count the images correct | ||
$collageConfig->collageLimit = (int) ($config['collage']['placeholder'] ? $config['collage']['limit'] + 1 : $config['collage']['limit']); | ||
$collageConfig->pictureFlip = $config['picture']['flip']; | ||
$collageConfig->pictureRotation = (int) $config['picture']['rotation']; | ||
$collageConfig->picturePolaroidEffect = $config['picture']['polaroid_effect'] === true ? 'enabled' : 'disabled'; | ||
$collageConfig->picturePolaroidRotation = (int) $config['picture']['polaroid_rotation']; | ||
$collageConfig->textOnCollageEnabled = $config['textoncollage']['enabled'] === true ? 'enabled' : 'disabled'; | ||
$collageConfig->textOnCollageLine1 = $config['textoncollage']['line1']; | ||
$collageConfig->textOnCollageLine2 = $config['textoncollage']['line2']; | ||
$collageConfig->textOnCollageLine3 = $config['textoncollage']['line3']; | ||
$collageConfig->textOnCollageLocationX = (int) $config['textoncollage']['locationx']; | ||
$collageConfig->textOnCollageLocationY = (int) $config['textoncollage']['locationy']; | ||
$collageConfig->textOnCollageRotation = (int) $config['textoncollage']['rotation']; | ||
$collageConfig->textOnCollageFont = PathUtility::getAbsolutePath($config['textoncollage']['font']); | ||
$collageConfig->textOnCollageFontColor = $config['textoncollage']['font_color']; | ||
$collageConfig->textOnCollageFontSize = (int) $config['textoncollage']['font_size']; | ||
$collageConfig->textOnCollageLinespace = (int) $config['textoncollage']['linespace']; | ||
|
||
return $collageConfig; | ||
} | ||
} |