Warm tip: This article is reproduced from serverfault.com, please click

imagemagick-如何在docker项目下将图像magick添加到我的laravel中?

(imagemagick - How to add image magick to my laravel under docker project?)

发布于 2020-12-01 12:12:51

我在docker下运行laravel应用程序,我想通过添加libmagickwand-dev lib来添加image magick支持,但出现错误:

而且我在运行docker-compose up -d --build时遇到错误:

...
Step 7/9 : RUN  docker-php-ext-install gd pdo pdo_mysql zip gmp bcmath pcntl ldap sysvmsg exif  && a2enmod rewrite
 ---> Using cache
 ---> 57b5ffd40a2f
Step 8/9 : RUN docker-php-ext-install libmagickwand
 ---> Running in 5066ebf866a8
error: /usr/src/php/ext/libmagickwand does not exist

usage: /usr/local/bin/docker-php-ext-install [-jN] [--ini-name file.ini] ext-name [ext-name ...]
   ie: /usr/local/bin/docker-php-ext-install gd mysqli
       /usr/local/bin/docker-php-ext-install pdo pdo_mysql
       /usr/local/bin/docker-php-ext-install -j5 gd mbstring mysqli pdo pdo_mysql shmop

if custom ./configure arguments are necessary, see docker-php-ext-configure

Possible values for ext-name:                                                                                                                                                                                          
bcmath bz2 calendar ctype curl dba dom enchant exif fileinfo filter ftp gd gettext gmp hash iconv imap interbase intl json ldap mbstring mysqli oci8 odbc opcache pcntl pdo pdo_dblib pdo_firebird pdo_mysql pdo_oci pdo_odbc pdo_pgsql pdo_sqlite pgsql phar posix pspell readline recode reflection session shmop simplexml snmp soap sockets sodium spl standard sysvmsg sysvsem sysvshm tidy tokenizer wddx xml xmlreader xmlrpc xmlwriter xsl zend_test zip                                                                                                                                                                                                     
                                                                                                                                                                                                                       
Some of the above modules are already compiled into PHP; please check                                                                                                                                                  
the output of "php -i" to see which modules are already loaded.                                                                                                                                                        
ERROR: Service 'web' failed to build: The command '/bin/sh -c docker-php-ext-install libmagickwand' returned a non-zero code: 1   

在__DOCKER / web / Dockerfile.yml中:

In FROM php:7.3-apache

RUN apt-get update && \
    apt-get install -y \
    python \
    libfreetype6-dev \
    libwebp-dev \
    libjpeg62-turbo-dev \
    libpng-dev \
    libzip-dev \
    nano \
    mc \
    git-core \

    libmagickwand-dev \

    curl \
    ...
  RUN npm install cross-env

  RUN npm install -g yarn

  RUN  docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-webp-dir=/usr/include/  --with-jpeg-dir=/usr/include/


  # Install Composer
  RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

  RUN  docker-php-ext-install gd pdo pdo_mysql zip gmp bcmath pcntl ldap sysvmsg exif  \
&& a2enmod rewrite

#  RUN install-php-extensions imagick
  RUN docker-php-ext-install libmagickwand

COPY virtualhost.conf /etc/apache2/sites-enabled/000-default.conf

我不确定,但是在网上搜索后发现,如果从php:7.3-apache安装了docker,则不支持image magick。是这样吗?如何在我的项目中添加图片魔术?

谢谢!

Questioner
mstdmstd
Viewed
0
Jonathan privé 2020-12-01 22:15:58

你好,我发现该帖子
可以帮助你,google上的关键字:docker php 7.3 with imagick

对于建议,我还建议你查看vips,如果找不到任何解决方案,则有可能取代imagick。