Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoDecodeDelegateForThisImageFormat `JPEG' @ error/constitute.c/ReadImage/50 #237

Closed
tudor2004 opened this issue Jun 30, 2018 · 9 comments
Closed

Comments

@tudor2004
Copy link

Can anybody help with the following error?

NoDecodeDelegateForThisImageFormat `JPEG' @ error/constitute.c/ReadImage/50
  9

I'm not sure what kind of library I'm missing, this is my docker file

FROM php:7.1-fpm-alpine

# intl, zip, soap
RUN apk add --update --no-cache libintl icu icu-dev libxml2-dev \
    && docker-php-ext-install intl zip soap

# mysqli, pdo, pdo_mysql
RUN docker-php-ext-install mysqli pdo pdo_mysql

# mcrypt, gd, iconv
RUN apk add --update --no-cache freetype-dev libjpeg-turbo-dev libmcrypt-dev libpng-dev \
    && docker-php-ext-install iconv mcrypt \
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
    && docker-php-ext-install gd

# gmp, bcmath
RUN apk add --update --no-cache gmp gmp-dev \
    && docker-php-ext-install gmp bcmath

# redis, apcu
RUN docker-php-source extract \
    && apk add --no-cache --virtual .phpize-deps-configure $PHPIZE_DEPS \
    && pecl install redis \
    && pecl install apcu \
    && docker-php-ext-enable redis apcu \
    && apk del .phpize-deps-configure \
    && docker-php-source delete

# imagick
RUN apk add --update --no-cache autoconf g++ imagemagick-dev libtool make pcre-dev \
    && pecl install imagick \
    && docker-php-ext-enable imagick \
    && apk del autoconf g++ libtool make pcre-dev

# git client, mysql-client
RUN apk add --update --no-cache git mysql-client

# pcntl
RUN docker-php-ext-install pcntl

RUN sed -i -e 's/listen.*/listen = 0.0.0.0:9000/' /usr/local/etc/php-fpm.conf

RUN echo "expose_php=0" > /usr/local/etc/php/php.ini

CMD ["php-fpm"]
@cdowdy
Copy link

cdowdy commented Jun 30, 2018

That's an imagick error. You need to make sure you have the proper "delegates" built in. Open up a command line and type convert -version and make sure jpeg is listed.

@tudor2004
Copy link
Author

tudor2004 commented Jun 30, 2018

@cdowdy convert -version says sh: convert: not found, also tried magic convert -version

@cdowdy
Copy link

cdowdy commented Jun 30, 2018

it's an imagick/docker error not a glide one. Either imagick isn't installed, isn't installed properly, cannot be found by php, not enabled or you can't be found in the path.

Did a quick Google for you and this may help
docker-library/php#105

@tudor2004
Copy link
Author

ok, I ended up using another base image for PHP that is not based on alpine. the rest of the dockerfile logic remained the same

@ambis
Copy link

ambis commented Mar 23, 2019

For others who googled themselves here, I was having the exact same problem (well, different line number in the error). My Dockerfile was pretty much identical with anything related to imagick.

My problem was that I was missing imagemagick itself. After adding apk add for imagemagick, problem was fixed and php -r 'print_r(Imagick::queryFormats());' list was no longer empty, it had 227 values including JPEG etc.

@julitroalves
Copy link

julitroalves commented Feb 20, 2020

Using alpine image docker i just added this to my image and rebuild docker image.

RUN set -ex \ 
&& apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS imagemagick-dev libtool \
&& export CFLAGS="$PHP_CFLAGS" CPPFLAGS="$PHP_CPPFLAGS" LDFLAGS="$PHP_LDFLAGS" \ 
&& pecl install imagick-3.4.3 \
&& docker-php-ext-enable imagick \ && apk add --no-cache --virtual .imagick-runtime-deps imagemagick \ 
&& apk del .phpize-deps

@michabbb
Copy link

@julitroalves just wanted to let you know: your lines saved my problem 👍

@michabbb
Copy link

michabbb commented Mar 10, 2020

a question to all: I use https://github.com/docker-slim/docker-slim to tiny my PHP image. the fantastic thing is: the size shrinks from 500MB to 100MB BUT that´s only because a lot of things gets deleted.
the base-image shows me every image format Imagick::queryFormats() : but the tiny image doesn´t show anything, so I am sure, there are some files somewhere, that must not be deleted. does anybody has an idea where these files are ? because docker-slim supports the --include-path option, to keep some folders (or files) from seeing deleted. thanks for any help!!

UPDATE: in case someone is interested, here´s my call to slim an alpine docker image and keep imagemagick working (that does not mean everything else is working 😏 ):

docker run --rm -v /docker/images/php/7.4:/app -w /app -v /var/run/docker.sock:/var/run/docker.sock dslim/docker-slim:latest build --dockerfile Dockerfile --include-exe --include-shell --include-path /etc/ImageMagick-7 --include-path /usr/share/ImageMagick-7 --include-path /usr/lib/ImageMagick-7.0.10 --include-path /etc/ssl/ --include-path /etc/fonts/ --include-path /usr/local/bin/ --include-path /usr/lib/libjpeg.so.8 --include-path /usr/lib//usr/lib/libjpeg.so.8.2.2 --include-path /usr/lib/libjpeg.so --include-path /usr/lib/libturbojpeg.so.0 --include-path /usr/lib/libjpeg.so.8.2.2 --include-path /usr/lib/libturbojpeg.so --include-path /usr/lib/libturbojpeg.so.0.2.0 --tag php:7.4-fpm.slim .

@ADmad
Copy link
Collaborator

ADmad commented Mar 5, 2021

Closing as the issue seems to be resolved and isn't directly related Glide's code.

@ADmad ADmad closed this as completed Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants