From 0301758cf7f6c22814476c5f18a28010c1473819 Mon Sep 17 00:00:00 2001 From: Michael Ziem Date: Tue, 4 Jan 2022 18:21:18 +0100 Subject: [PATCH 1/6] Scaffold: Add .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..485dee6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea From 482917a5c1ef699e0a0bf7f66be9de1fe83e31ac Mon Sep 17 00:00:00 2001 From: Michael Ziem Date: Tue, 4 Jan 2022 18:50:00 +0100 Subject: [PATCH 2/6] Fix: Issue where image size was wrong for antialias > 1 --- lib/effect_insert_text.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/effect_insert_text.php b/lib/effect_insert_text.php index 6d13596..3a55b79 100644 --- a/lib/effect_insert_text.php +++ b/lib/effect_insert_text.php @@ -285,8 +285,8 @@ public function execute() // get new Image-Size $imgWidth = imagesx($gdTemp); $imgHeight = imagesy($gdTemp); - $the_box['width'] = $imgWidth; - $the_box['height'] = $imgHeight; + $the_box['width'] = $imgWidth / $scale; + $the_box['height'] = $imgHeight / $scale; $bgpadding = 0; } From bffd5fcfdb419061c27f0138a5d97f02ef8f31ef Mon Sep 17 00:00:00 2001 From: Michael Ziem Date: Tue, 4 Jan 2022 18:51:01 +0100 Subject: [PATCH 3/6] Fix: Text color and shadow color for antialias = 0 --- lib/effect_insert_text.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/effect_insert_text.php b/lib/effect_insert_text.php index 3a55b79..166da99 100644 --- a/lib/effect_insert_text.php +++ b/lib/effect_insert_text.php @@ -247,9 +247,6 @@ public function execute() // Write text shadow if ($outputshadow) { $col = imagecolorallocatealpha($gdTemp, $shadowcolor[0], $shadowcolor[1], $shadowcolor[2], $shadowalpha); - if ($antialiasing === 0) { - $col = -$col; - } imagettftext( $gdTemp, $fontSize * $scale, @@ -264,9 +261,6 @@ public function execute() // Write text $col = imagecolorallocatealpha($gdTemp, $color[0], $color[1], $color[2], $alpha); - if ($antialiasing === 0) { - $col = -$col; - } imagettftext( $gdTemp, $fontSize * $scale, @@ -509,7 +503,7 @@ public function getParams() 'type' => 'select', 'options' => ['left', 'center', 'right'], 'default' => 'center', - ], + ], [ 'label' => rex_i18n::msg('media_manager_effect_insert_text_vpos'), 'name' => 'vpos', From 9543c4c12e1689057dbb7887bfc71bae4ddab99f Mon Sep 17 00:00:00 2001 From: Michael Ziem Date: Tue, 4 Jan 2022 19:09:50 +0100 Subject: [PATCH 4/6] Update: Refactor var name --- lib/effect_insert_text.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/effect_insert_text.php b/lib/effect_insert_text.php index 166da99..7ce005a 100644 --- a/lib/effect_insert_text.php +++ b/lib/effect_insert_text.php @@ -95,22 +95,22 @@ public function execute() $position[1] = (string) $txtparams[4]; } - // Default Padding - $padding = [0, 30]; + // Default Margin + $margin = [0, 30]; // Padding if (isset($this->params['padding_x']) && $this->params['padding_x'] <> '') { - $padding[0] = (int) $this->params['padding_x']; + $margin[0] = (int) $this->params['padding_x']; } if (isset($txtparams[5]) && $txtparams[5] <> '') { - $padding[0] = (int) $txtparams[5]; + $margin[0] = (int) $txtparams[5]; } if (isset($this->params['padding_y']) && $this->params['padding_y'] <> '') { - $padding[1] = (int) $this->params['padding_y']; + $margin[1] = (int) $this->params['padding_y']; } if (isset($txtparams[6]) && $txtparams[6] <> '') { - $padding[1] = (int) $txtparams[6]; + $margin[1] = (int) $txtparams[6]; } // Antialiasing @@ -318,8 +318,8 @@ public function execute() imagecopyresampled( $sourceImage, $gdTemp, - $dstX + $padding[0], - $dstY + $padding[1], + $dstX + $margin[0], + $dstY + $margin[1], 0, 0, $the_box['width'] + ($bgpadding*2), From f1c0ac06450e6cd79ad3be36a2fe6617507893e7 Mon Sep 17 00:00:00 2001 From: Michael Ziem Date: Tue, 4 Jan 2022 19:41:51 +0100 Subject: [PATCH 5/6] Scaffold: gitignore .DS_Store files --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 485dee6..090a1f0 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .idea +.DS_Store From 8f8f8c44c3a257a2096f16229b8b5d878ea1287d Mon Sep 17 00:00:00 2001 From: Michael Ziem Date: Mon, 10 Jan 2022 18:36:05 +0100 Subject: [PATCH 6/6] Version bump --- package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.yml b/package.yml index b30a081..82ac32b 100644 --- a/package.yml +++ b/package.yml @@ -1,5 +1,5 @@ package: insert_text -version: "2.0.0" +version: "2.0.1" name: Insert Text author: Friends Of REDAXO supportpage: https://github.com/FriendsOfREDAXO/insert_text