Solved undefined function imagecreatefromjpeg

[Solved] `Call to undefined function Intervention\Image\Gd\imagecreatefromjpeg()`

[PHP 7.4 Changelog](https://www.php.net/manual/en/migration74.other-changes.php) in GD section

we can run docker-php-ext-configure command to configure our gd with JPEG support. 
we don't need to provide flag to enable PNG.

```
$ docker exec -it laradock_php-worker_1 php -r 'print_r(gd_info());'
Array
(
    [GD Version] => bundled (2.1.0 compatible)
    [FreeType Support] => 1
    [FreeType Linkage] => with freetype
    [GIF Read Support] => 1
    [GIF Create Support] => 1
    [JPEG Support] => 1
    [PNG Support] => 1
    [WBMP Support] => 1
    [XPM Support] => 
    [XBM Support] => 1
    [WebP Support] => 
    [BMP Support] => 1
    [TGA Read Support] => 1
    [JIS-mapped Japanese Font Support] => 
)
```
This commit is contained in:
許益銘 2022-05-06 23:40:14 +08:00 committed by GitHub
parent a2dd97674f
commit 7abbfd3142
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -87,7 +87,7 @@ ARG INSTALL_GD=false
RUN if [ ${INSTALL_GD} = true ]; then \ RUN if [ ${INSTALL_GD} = true ]; then \
apk add --update --no-cache freetype-dev libjpeg-turbo-dev jpeg-dev libpng-dev; \ apk add --update --no-cache freetype-dev libjpeg-turbo-dev jpeg-dev libpng-dev; \
if [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && [ $(php -r "echo PHP_MINOR_VERSION;") = "4" ]; then \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && [ $(php -r "echo PHP_MINOR_VERSION;") = "4" ]; then \
docker-php-ext-configure gd --with-freetype --with-jpeg --with-png; \ docker-php-ext-configure gd --with-freetype --with-jpeg; \
else \ else \
docker-php-ext-configure gd --with-freetype-dir=/usr/lib/ --with-jpeg-dir=/usr/lib/ --with-png-dir=/usr/lib/; \ docker-php-ext-configure gd --with-freetype-dir=/usr/lib/ --with-jpeg-dir=/usr/lib/ --with-png-dir=/usr/lib/; \
fi; \ fi; \