3

I was experiencing weird GD library issues with Drupal 8, when the site tries to generate thumbnails from image style. I am using Docker PHP.

The error is simply saying Error generating image. I checked the logs, but I didn't find anything helpful.

3

This is the fix for the issue.

The code taken from duplicated issue in https://stackoverflow.com/questions/36359917/docker-gd-module-for-php-7

Please take this with heaps of grain and salt, and modify the script accordingly.

# Install GD
RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng12-dev
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
RUN docker-php-ext-install gd

What is actually happens is your GD library is installed BUT without JPEG library configured. Your Drupal will be chill saying GD installed but there is hidden requirement that JPEG need to be exist too.

The line 179 in GDToolkit.php:

$function = 'imagecreatefrom' . image_type_to_extension($this->getType(), FALSE);

Causes the function imagecreateformjpeg fails to be executed.

Hope it helps someone that confused, cant generate thumbnail with limited knowledge of the errors.

:)

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.