Under docker error Call to undefined function Intervention\Image\Gd\imagecreatefromjpeg

Viewed 5746

I try to install my laravel 5.7.19 application under docker(version: '3.1', ) and running some pages I got error:

Call to undefined function Intervention\Image\Gd\imagecreatefromjpeg()

I include jpeg support in web/Dockerfile.yml:

FROM php:7.2-apache

RUN apt-get update -y && apt-get install -y libpng-dev libjpeg-dev libxpm-dev libfreetype6-dev  nano  \
    && docker-php-ext-configure gd \
    --with-freetype-dir=/usr/include/ \
    --with-jpeg-dir=/usr/include/ \
    --with-xpm-dir=/usr/include/ \
    --with-vpx-dir=/usr/include/

RUN docker-php-ext-install \
    pdo_mysql \
    && a2enmod \
    rewrite


RUN docker-php-ext-install gd

But I have the same error anyway. Is path “/usr/include/” valid and how to check it ?

My working OS is Kubuntu 18...

Thanks!

1 Answers

You need to add into Dockerfile.yml file including of gd and types format like :

FROM php:7.2-apache

RUN apt-get update && \
    apt-get install -y \
    libfreetype6-dev \
    libwebp-dev \
    libjpeg62-turbo-dev \
    libpng-dev \
    nano \
    libgmp-dev \
    libldap2-dev \
    netcat \
    sqlite3 \
    libsqlite3-dev && \
    docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-webp-dir=/usr/include/  --with-jpeg-dir=/usr/include/ && \
    docker-php-ext-install gd pdo pdo_mysql pdo_sqlite zip gmp bcmath pcntl ldap sysvmsg exif \
&& a2enmod rewrite

That must help.

Related