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

text on {picture,collage,print}: use color picker #312

Merged
merged 1 commit into from
Sep 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions config/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@
$config['textonpicture']['locationy'] = '80';
$config['textonpicture']['rotation'] = '0';
$config['textonpicture']['font'] = 'resources/fonts/GreatVibes-Regular.ttf';
// possible font_color values: 'white', 'grey', 'black'
$config['textonpicture']['font_color'] = 'white';
$config['textonpicture']['font_color'] = '#ffffff';
$config['textonpicture']['font_size'] = '80';
$config['textonpicture']['linespace'] = '90';

Expand Down Expand Up @@ -109,8 +108,7 @@
$config['textoncollage']['locationy'] = '250';
$config['textoncollage']['rotation'] = '0';
$config['textoncollage']['font'] = 'resources/fonts/GreatVibes-Regular.ttf';
// possible font_color values: 'white', 'grey', 'black'
$config['textoncollage']['font_color'] = 'black';
$config['textoncollage']['font_color'] = '#000000';
$config['textoncollage']['font_size'] = '50';
$config['textoncollage']['linespace'] = '90';
// DO NOT CHANGE limit here
Expand Down Expand Up @@ -198,8 +196,7 @@
$config['textonprint']['locationy'] = '1050';
$config['textonprint']['rotation'] = '40';
$config['textonprint']['font'] = 'resources/fonts/GreatVibes-Regular.ttf';
// possible font_color values: 'white', 'grey', 'black'
$config['textonprint']['font_color'] = 'black';
$config['textonprint']['font_color'] = '#ffffff';
$config['textonprint']['font_size'] = '100';
$config['textonprint']['linespace'] = '100';

Expand Down
10 changes: 3 additions & 7 deletions lib/applyText.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@ function ApplyText($srcImagePath, $fontsize, $fontrot, $fontlocx, $fontlocy, $fo
$quality = 100;
$font = realpath(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . $fontpath);
$image = imagecreatefromjpeg($srcImagePath);
if ($fontcolor === 'white') {
$color = imagecolorallocate($image, 255, 255, 255);
} elseif ($fontcolor === 'grey') {
$color = imagecolorallocate($image, 128, 128, 128);
} else {
$color = imagecolorallocate($image, 0, 0, 0);
}
list($r, $g, $b) = sscanf($fontcolor, '#%02x%02x%02x');
$color = imagecolorallocate($image, $r, $g, $b);

if (!empty($line1text)) {
imagettftext($image, $fontsize, $fontrot, $fontlocx, $fontlocy, $color, $font, $line1text);
}
Expand Down
21 changes: 3 additions & 18 deletions lib/configsetup.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -544,14 +544,9 @@
],
'textonpicture_font_color' => [
'view' => 'expert',
'type' => 'select',
'type' => 'color',
'name' => 'textonpicture[font_color]',
'placeholder' => $defaultConfig['textonpicture']['font_color'],
'options' => [
'white' => 'white',
'grey' => 'grey',
'black' => 'black',
],
'value' => $config['textonpicture']['font_color'],
],
'textonpicture_font_size' => [
Expand Down Expand Up @@ -715,14 +710,9 @@
],
'textoncollage_font_color' => [
'view' => 'expert',
'type' => 'select',
'type' => 'color',
'name' => 'textoncollage[font_color]',
'placeholder' => $defaultConfig['textoncollage']['font_color'],
'options' => [
'white' => 'white',
'grey' => 'grey',
'black' => 'black',
],
'value' => $config['textoncollage']['font_color'],
],
'textoncollage_font_size' => [
Expand Down Expand Up @@ -1204,14 +1194,9 @@
],
'textonprint_font_color' => [
'view' => 'expert',
'type' => 'select',
'type' => 'color',
'name' => 'textonprint[font_color]',
'placeholder' => $defaultConfig['textonprint']['font_color'],
'options' => [
'white' => 'white',
'grey' => 'grey',
'black' => 'black',
],
'value' => $config['textonprint']['font_color'],
],
'textonprint_font_size' => [
Expand Down