Skip to content

Latest commit

 

History

History
41 lines (28 loc) · 1.43 KB

magick.md

File metadata and controls

41 lines (28 loc) · 1.43 KB

ImageMagick or GraphicMagick

If you need ImageMagick or GraphicMagick as a PHP module, you need to install and activate it. You can create your own Dockerfile and derive from this image.

Both are already preinstalled in the Docker image and it is recommended that you use these binaries instead of the PHP module.

For Example:

<?php exec('/usr/bin/convert ...');

Install ImageMagick or GraphicMagick included in PHP

If you still want to install and activate the Magick PHP module, then create your own Dockerfile.

Install ImageMagick:

RUN apt install -y imagemagick libmagickwand-dev && printf "\n" | pecl install imagick

Install GraphicMagick:

RUN apt install -y graphicsmagick gcc libgraphicsmagick1-dev && \
    PHP_VERSION=`php -r "echo version_compare(PHP_VERSION, '7.0.0', '<');";` && \
    if [ "${PHP_VERSION}" = "1" ]; then printf "\n" | pecl install gmagick-1.1.7RC3; else printf "\n" | pecl install gmagick-2.0.5RC1; fi;

Because of apparently too similar symbols, you can only activate one of them in PHP. If you activate both, PHP will not work properly anymore. Therefore either use ImageMagick or GraphicMagick:

# For ImageMagick
RUN echo 'extension=imagick.so' >> /usr/local/etc/php/conf.d/docker-php-ext-magick.ini;

# For GraphicMagick
RUN echo 'extension=gmagick.so' >> /usr/local/etc/php/conf.d/docker-php-ext-magick.ini;