Out there in #2655044: Add "Text overlay" image effect, I forgot to move from Textimage the hook_requirements() implementation in .install that checks for GD FreeType support, needed by the 'Text overlay' effect.

Doing it here. However, I am suggesting to only raise a warning at install/runtime, not an error like in Textimage - IMO it would be too strict to prevent the entire module to get installed. To avoid possible fatals, I am introducing two wrapper methods to imagettftext and imagettfbbox that check for the function existence, and if not, raise an exception that gets logged.

Comments

mondrake created an issue. See original summary.

mondrake’s picture

Status: Active » Needs review
StatusFileSize
new4.7 KB

Patch

fietserwin’s picture

+++ b/src/Plugin/ImageToolkit/Operation/gd/GDOperationTrait.php
@@ -145,4 +145,40 @@ trait GDOperationTrait {
+  /**
+   * Wrapper of imagettftext().
+   *
+   * If imagettftext() is missing, throw an exception instead of failing
+   * fatally.
+   */
+  protected function _imagettftext($image, $size, $angle, $x, $y, $color, $fontfile, $text) {

Should we add @param and @return, for better type checking and auto-completion? Same for _imagettfbox().

For the rest it's OK.

mondrake’s picture

StatusFileSize
new2.12 KB
new6 KB

Thanks @fietserwin, done + added @see to PHP docs.

fietserwin’s picture

Status: Needs review » Reviewed & tested by the community

Go ahead.

slashrsm’s picture

Status: Reviewed & tested by the community » Fixed

Committed.

  • slashrsm committed cd16c28 on 8.x-1.x authored by mondrake
    Issue #2701057 by mondrake, fietserwin: GD FreeType library requirements...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.