fix: GD safety check + zlib-dev for robust Alpine build
- video_api.php: check function_exists('imagecreatefromstring') before calling GD
— undefined function causes PHP fatal error even with @ suppressor, kills php-fpm
- Dockerfile: add zlib-dev (required for libpng on some Alpine versions)
- Dockerfile: verify GD loaded after install (build log confirmation)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e43432e08c
commit
53c4e9f8a3
2 changed files with 9 additions and 2 deletions
|
|
@ -69,6 +69,12 @@ class VeoVideoAPI {
|
|||
[$targetW, $targetH] = $targets[$aspectRatio];
|
||||
$targetRatio = $targetW / $targetH;
|
||||
|
||||
// GD may not be installed — fatal errors from undefined functions can't be suppressed
|
||||
if (!function_exists('imagecreatefromstring')) {
|
||||
error_log("resizeImageForVeo: GD extension not available, skipping resize");
|
||||
return $base64Data;
|
||||
}
|
||||
|
||||
$decoded = base64_decode($base64Data);
|
||||
if ($decoded === false) return $base64Data;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,9 +9,10 @@ RUN npm run build
|
|||
|
||||
# ── Stage 2: runtime (nginx + php-fpm) ────────────────────────────────────────
|
||||
FROM php:8.2-fpm-alpine
|
||||
RUN apk add --no-cache nginx supervisor libpng-dev libjpeg-turbo-dev \
|
||||
RUN apk add --no-cache nginx supervisor libpng-dev libjpeg-turbo-dev zlib-dev \
|
||||
&& docker-php-ext-configure gd --with-jpeg \
|
||||
&& docker-php-ext-install -j$(nproc) gd
|
||||
&& docker-php-ext-install -j$(nproc) gd \
|
||||
&& php -m | grep -i gd && echo "GD installed OK" || echo "GD missing — resize disabled"
|
||||
|
||||
# Composer
|
||||
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue