Reputation: 1
My function returns the error message:
Call to undefined function imagettftext()
I've already tried every thing and won't able enable (--with-freetype-dir=DIR)
$black = imagecolorallocate($text_im, 0, 0, 0);
imagefilledrectangle($text_im, 0, 0, 399, 29, $white);
$text = 'testing shop ,9876543214';
// Replace path by your own font path
$font = 'arial.ttf';
imagettftext($text_im, 20, 0, 10, 20, $black, $font, $text);
imagepng($text_im);```
Upvotes: 0
Views: 298
Reputation: 5802
Both GD and Freetype have to be installed, Freetype can be installed using:
brew install freetype
When the installation finishes execute the following command to get the path:
echo "/usr/local/Cellar/freetype/$(ls /usr/local/Cellar/freetype)/lib"
and then use that path in the flag:
--with-freetype-dir=/usr/local/Cellar/freetype/2.10.1/lib
The second option is to compile PHP from scratch by following these steps:
./configure \
--prefix=/usr/local/bin/php \
--with-apxs2=/usr/local/apache/bin/apxs \
--enable-mbstring \
--with-curl \
--with-openssl \
--with-xmlrpc \
--enable-soap \
--enable-zip \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-mysqli \
--with-pgsql \
--enable-embedded-mysqli \
--with-freetype-dir \
--with-ldap \
--enable-intl \
--with-xsl \
--with-zlib
make
make install
Upvotes: 2