Linux, FreeBSD, Juniper, Cisco / Network security articles and troubleshooting guides

FAQ
It is currently Fri Dec 09, 2016 6:46 pm


This forum is dedicated to Apache, Nginx, Lighttpd, Squid and other HTTP transport protocol related software

Author Message
mandrei99
Post  Post subject: php gmagick No decode delegate for this image format JPG  |  Posted: Wed Aug 28, 2013 4:39 am

Joined: Tue Aug 04, 2009 9:16 am
Posts: 245

Offline
 

php gmagick No decode delegate for this image format JPG

After installing php gmagick module and graphicks magick utility using ./configure --enable-shared configure options, I ran into following php(I thought) error when trying to use graphicks magick to alter a JPG image:
Code:
No decode delegate for this image format (./imgs/_DSC2900.JPG)


This is because graphics magick ./configure --help does not show that you need to explicitly enable jpeg format support:
Code:
# ./configure --help 2>&1 | grep -iE "jpg|jpeg"
  --without-jpeg          disable JPEG support
  --without-jp2           disable JPEG v2 support

There are only options to disable JPEG support, not to enable it.

After running the ./configure graphics magick script, the status output was:
Code:
Options used to compile and link:
  CC       = gcc -std=gnu99
  CFLAGS   = -fopenmp -g -O2 -Wall -pthread
  CPPFLAGS = -I/usr/include/libxml2
  CXX      = g++
  CXXFLAGS = -pthread
  DEFS     = -DHAVE_CONFIG_H
  LDFLAGS  = -L/usr/lib
  LIBS     = -ljpeg -lpng12 -lxml2 -lz -lm -lgomp -lpthread


But after compiling and checking the gm binary:
Code:
# ldd `which gm`
        linux-vdso.so.1 =>  (0x00007fffd37ff000)
        libGraphicsMagick.so.3 => /usr/lib/libGraphicsMagick.so.3 (0x00007fabfd338000)
        libpng12.so.0 => /lib/libpng12.so.0 (0x00007fabfced8000)
        libxml2.so.2 => /usr/lib/libxml2.so.2 (0x00007fabfcb87000)
        libz.so.1 => /usr/lib/libz.so.1 (0x00007fabfc970000)
        libm.so.6 => /lib/libm.so.6 (0x00007fabfc6ed000)
        libgomp.so.1 => /usr/lib/libgomp.so.1 (0x00007fabfc4e0000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x00007fabfc2c4000)
        libc.so.6 => /lib/libc.so.6 (0x00007fabfbf61000)
        libdl.so.2 => /lib/libdl.so.2 (0x00007fabfbd5d000)
        librt.so.1 => /lib/librt.so.1 (0x00007fabfbb55000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fabfd7b4000)

... no jpeg library was linked to the binary... meaning that graphics magick was not supporting it...


Although, libjpeg-dev package was installed:
Code:
# dpkg -l | grep libjpeg
ii  libjpeg8                            8b-1                         The Independent JPEG Group's JPEG runtime library
ii  libjpeg8-dev                        8b-1                         Development files for the IJG JPEG library


Checking the configure script, I could see there is an option to enable JPEG support:
Code:
# grep with-jpeg configure
# Check whether --with-jpeg was given.
    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-jpeg=$with_jpeg "
echo "JPEG v1           --with-jpeg=$with_jpeg          $have_jpeg"


Installing Graphics Magick the correct way:
1. Make sure autoconf and libjpeg-dev utilities are installed:
Code:
# dpkg -l | grep -E "autoconf|libjpeg"
ii  autoconf                            2.67-2                       automatic configure script builder
ii  libjpeg8                            8b-1                         The Independent JPEG Group's JPEG runtime library
ii  libjpeg8-dev                        8b-1                         Development files for the IJG JPEG library

2. Configure and install graphics magick:
Code:
# ./configure --enable-shared --with-jpeg
# make
# make install
# /path/to/php/pecl install gmagick-1.0.8b2


Checking the GM binary after installation:
Code:
# ldd `which gm`
        linux-vdso.so.1 =>  (0x00007fffa8fa0000)
        libGraphicsMagick.so.3 => /usr/lib/libGraphicsMagick.so.3 (0x00007f22009f0000)
        libjpeg.so.8 => /usr/lib/libjpeg.so.8 (0x00007f22007b7000)              --> JPEG library is now linked
        libpng12.so.0 => /lib/libpng12.so.0 (0x00007f2200590000)
        libxml2.so.2 => /usr/lib/libxml2.so.2 (0x00007f220023f000)
        libz.so.1 => /usr/lib/libz.so.1 (0x00007f2200028000)
        libm.so.6 => /lib/libm.so.6 (0x00007f21ffda5000)
        libgomp.so.1 => /usr/lib/libgomp.so.1 (0x00007f21ffb98000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x00007f21ff97c000)
        libc.so.6 => /lib/libc.so.6 (0x00007f21ff619000)
        libdl.so.2 => /lib/libdl.so.2 (0x00007f21ff415000)
        librt.so.1 => /lib/librt.so.1 (0x00007f21ff20d000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f2200e6c000)

Few commands to debug Graphics Magick format support and identify an image file:
Code:
# gm identify -verbose /path/to/file.JPG
# gm convert -list formats | grep -i jpeg





Top
Display posts from previous:  Sort by  
E-mail friendPrint view
Who is online
Users browsing this forum: No registered users and 0 guests
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
Jump to:  
News News Site map Site map SitemapIndex SitemapIndex RSS Feed RSS Feed Channel list Channel list


Delete all board cookies | The team | All times are UTC - 5 hours [ DST ]



phpBB SEO