Question to gd extension (JPEG and FreeType support)
rraab-dev opened this issue ยท 10 comments
Hello,
nice work first of all! This image/container is just replacing XAMPP on my development environment.
One thing I did not get running fully was the GD extension.
Basically I want to achieve that phpinfo() returns in the gd section the following entries, which it does not yet:
FreeType Support => enabled
FreeType Linkage => with freetype
FreeType Version => x.x.x
JPEG Support => enabled
libJPEG Version => 9 compatible
How can I achieve this?
(I need to work with JPG images in my project, to add a watermark to an uploaded jpg image and save it.)
Thanks in advance
maybe need to configure - (it might require some extra apk add for header files) - would you have some time to play around on it? thanks for opening issue
Thanks for the fast response.
It is described in this article how to install the above mentioned dependencies.
- [You have to execute the following command to install a C compiler for the sources needed]
- apk add gcc g++ make libffi-dev openssl-dev
I get up to the section "Compile PHP", I have no idea how to recompile / reinstall / reconfigure php when php is already installed and preserving the already installed extensions / libraries. I would be thankfull if you could tell me what I have to do next.
Best regards and have a nice weekend! :)
yea like that - but if it is done in this container already - then you dont have to run those in your Dockerfile.
as such this should now be done in https://github.com/adhocore/docker-phpfpm instead (which is base docker image for this lemp)
Yes I think this is a good idea, because I am sure this extension is used quite regulary and would also be useful for others.
But still I do not know how to reconfigure / rebuild PHP with the following options (As described in the linked article.):
--with-gd --with-jpeg-dir --enable-gd-native-ttf --with-freetype-dir
May I ask you to add it to the docker-phpfpm image in return for a cup of coffee? ;)
you may want to fork that repo https://github.com/adhocore/docker-phpfpm and play around in this line:
https://github.com/adhocore/docker-phpfpm/blob/main/8.0.Dockerfile#L31 like so:
docker-php-ext-configure gd --with-gd --with-jpeg-dir --enable-gd-native-ttf --with-freetype-dir
that is sample code so may need to be modified
as for apk deps, they can be added around here:
https://github.com/adhocore/docker-phpfpm/blob/main/8.0.Dockerfile#L21-L27 (prod deps are kept, dev deps are erased after extensions are built)
if this works out, you can send a PR and will be official contributor to this little but useful thing :D
(PS: there is also PHP7.4 image with equivalent dockerfile: https://github.com/adhocore/docker-phpfpm/blob/main/7.4.Dockerfile)
(edit|ps: last time i tried to bump swoole extension version and that failed - so that probably needs to be downgraded to same old version)
May I ask you to add it to the docker-phpfpm image in return for a cup of coffee? ;)
well ;) if you insist, there is a Sponsor
button around top right of the repo - and thanks for interest :D :D
Haha okay I will try and let you know in your PayPal account when I surrendered.
Thanks for your time! :)
Done, may you review it. :)
adhocore/docker-phpfpm#35
great and thanks, did you run docker build locally? (how about swoole downgrade) ๐
nice yes I have built and run it locally (7.4 and 8.0.6 Version) and checkt with phpinf() and this extensions are now enabled.
I have not edited anything with swoole. :D
ok i fixed that in newer commits https://github.com/adhocore/docker-phpfpm/commits/main
phpfpm is already built and lemp is builing https://hub.docker.com/r/adhocore/lemp/tags?page=1&ordering=last_updated
you should be able to do docker pull adhocore/lemp:8.0
and docker pull adhocore/lemp:7.4
in about half an hour or less