Skip to content

Commit 2ac63cb

Browse files
committed
fix: Add WebP support to PHP GD for image style thumbnails
The media_library image style converts images to WebP format, but GD was compiled without WebP support causing 500 errors on thumbnail generation. Added libwebp-dev to build dependencies and --with-webp flag to GD configuration in both builder and runtime stages.
1 parent b9abb6c commit 2ac63cb

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

  • cloudformation/scenarios/localgov-drupal/docker

cloudformation/scenarios/localgov-drupal/docker/Dockerfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@ RUN apk add --no-cache \
1616
libpng-dev \
1717
libjpeg-turbo-dev \
1818
freetype-dev \
19+
libwebp-dev \
1920
libzip-dev \
2021
icu-dev \
2122
oniguruma-dev \
2223
$PHPIZE_DEPS
2324

24-
# Configure and install PHP extensions
25-
RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
25+
# Configure and install PHP extensions (with WebP support for image styles)
26+
RUN docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp \
2627
&& docker-php-ext-install -j$(nproc) \
2728
pdo_mysql \
2829
gd \
@@ -70,21 +71,23 @@ RUN apk add --no-cache \
7071
libpng \
7172
libjpeg-turbo \
7273
freetype \
74+
libwebp \
7375
libzip \
7476
icu \
7577
oniguruma \
7678
mysql-client \
7779
curl
7880

79-
# Install PHP extensions
81+
# Install PHP extensions (with WebP support for image styles)
8082
RUN apk add --no-cache \
8183
libpng-dev \
8284
libjpeg-turbo-dev \
8385
freetype-dev \
86+
libwebp-dev \
8487
libzip-dev \
8588
icu-dev \
8689
oniguruma-dev \
87-
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
90+
&& docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp \
8891
&& docker-php-ext-install -j$(nproc) \
8992
pdo_mysql \
9093
gd \
@@ -97,6 +100,7 @@ RUN apk add --no-cache \
97100
libpng-dev \
98101
libjpeg-turbo-dev \
99102
freetype-dev \
103+
libwebp-dev \
100104
libzip-dev \
101105
icu-dev \
102106
oniguruma-dev

0 commit comments

Comments
 (0)