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

Commit

Permalink
text on {picture,collage,print}: use color picker
Browse files Browse the repository at this point in the history
Change-Id: Ifa070e93a474bc3cbbd0489f95dff2bfc058785e
  • Loading branch information
andi34 committed Sep 18, 2021
1 parent 6096655 commit 530a5f2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 31 deletions.
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

0 comments on commit 530a5f2

Please sign in to comment.