PDF to JPG not working from php front end

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PDF to JPG not working from php front end

Post by fmw42 »

phpinfo file have ghostscript in it?
My phpinfo does not show IM nor ghostscript, yet I can run IM just fine.
danfar
Posts: 23
Joined: 2014-12-08T08:22:45-07:00
Authentication code: 6789

Re: PDF to JPG not working from php front end

Post by danfar »

how can I check that - thanks
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PDF to JPG not working from php front end

Post by fmw42 »

danfar wrote:how can I check that - thanks
I am not sure what you are asking
danfar
Posts: 23
Joined: 2014-12-08T08:22:45-07:00
Authentication code: 6789

Re: PDF to JPG not working from php front end

Post by danfar »

"Within PHP, what is the value of $PATH? Is Ghostscript on the path? Can other binaries be run from within PHP?"

how can I check that
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PDF to JPG not working from php front end

Post by fmw42 »

try

exec("echo $path");

I do not know the answers.

Try running gs from the command line. If that works, then try the same command in exec(). You may need to provide the full path to gs when in exec().
danfar
Posts: 23
Joined: 2014-12-08T08:22:45-07:00
Authentication code: 6789

Re: PDF to JPG not working from php front end

Post by danfar »

if you put gs on command it says
Ghostscript 8.70 Cannot open X display `(null)'.
**** Unable to open the initial device, quitting.

same on /usr/bin/gs
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PDF to JPG not working from php front end

Post by fmw42 »

Sorry I really do not know that much about Ghostscript and don't know why it needs X display. Perhaps you have a bad install. My only thought would be to upgrade IM and Ghostscript.
danfar
Posts: 23
Joined: 2014-12-08T08:22:45-07:00
Authentication code: 6789

Re: PDF to JPG not working from php front end

Post by danfar »

I ended up reinstalling everything from scratch - now I can conver pdf to jpf from gs exec frontend but imagickmagick doesnt convert

i dont see gs in delgates could that be the issue?

DELEGATES bzlib mpeg fontconfig freetype jng jpeg lcms pango png ps tiff x xml zlib

---------

DEFS -DHAVE_CONFIG_H
DELEGATES bzlib mpeg fontconfig freetype jng jpeg lcms pango png ps tiff x xml zlib
DISTCHECK_CONFIG_FLAGS --disable-deprecated --with-quantum-depth=16 --with-jemalloc=no --with-u mem=no --with-autotrace=no --with-gslib=no --with-fontpath= --with-gvc=no --with-rsvg=no --with -wmf=no --with-perl=no
DOCUMENTATION_PATH /usr/local/share/doc/ImageMagick-6
EXEC-PREFIX /usr/local
EXECUTABLE_PATH /usr/local/bin
FEATURES DPC OpenMP
FILTER_PATH /usr/local/lib/ImageMagick-6.9.0/modules-Q16/filters
HOST x86_64-unknown-linux-gnu
INCLUDE_PATH /usr/local/include/ImageMagick-6
LDFLAGS -L/usr/local/lib
LIB_VERSION 0x690
LIB_VERSION_NUMBER 6,9,0,0
LIBRARY_PATH /usr/local/lib/ImageMagick-6.9.0
LIBS -llcms -ltiff -lfreetype -ljpeg -lpng12 -lfontconfig -lXext -lXt -lSM -lICE -lX1 1 -lbz2 -pthread -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0 -lxml2 -lz -lm -lgomp
NAME ImageMagick
PCFLAGS -fopenmp -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16
PREFIX /usr/local
QuantumDepth 16
RELEASE_DATE 2014-12-11
SHARE_PATH /usr/local/share/ImageMagick-6
SHAREARCH_PATH /usr/local/lib/ImageMagick-6.9.0/config-Q16
SVN_REVISION 17068
TARGET_CPU x86_64
TARGET_OS linux-gnu
TARGET_VENDOR unknown
VERSION 6.9.0
WEBSITE http://www.imagemagick.org

Path: [built-in]

Name Value
-------------------------------------------------------------------------------
FEATURES OpenMP
NAME ImageMagick
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PDF to JPG not working from php front end

Post by fmw42 »

what do you get from

convert -version

where it shows delegates.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PDF to JPG not working from php front end

Post by fmw42 »

DELEGATES bzlib mpeg fontconfig freetype jng jpeg lcms pango png ps tiff x xml zlib
DISTCHECK_CONFIG_FLAGS --disable-deprecated --with-quantum-depth=16 --with-jemalloc=no --with-u mem=no --with-autotrace=no --with-gslib=no --with-fontpath= --with-gvc=no --with-rsvg=no --with -wmf=no --with-perl=no
You told it no gslib. Try installing by adding --with-gslib=yes and --with-gs-font-dir=/fullpath2/ghostscript/fonts/ to your ./configure.
danfar
Posts: 23
Joined: 2014-12-08T08:22:45-07:00
Authentication code: 6789

Re: PDF to JPG not working from php front end

Post by danfar »

Now:

DELEGATES bzlib mpeg fontconfig freetype gslib jng jpeg lcms pango png ps tiff x xml zlib
DISTCHECK_CONFIG_FLAGS --disable-deprecated --with-quantum-depth=16 --with-jemalloc= no --with-umem=no --with-autotrace=no --with-fontpath= --with-gvc=no --with-rsvg=no --with-wmf=no --with-perl=no
DOCUMENTATION_PATH /usr/local/share/doc/ImageMagick-6
EXEC-PREFIX /usr/local
EXECUTABLE_PATH /usr/local/bin
FEATURES DPC OpenMP
FILTER_PATH /usr/local/lib/ImageMagick-6.9.0/modules-Q16/filters
HOST x86_64-unknown-linux-gnu
INCLUDE_PATH /usr/local/include/ImageMagick-6
LDFLAGS -L/usr/local/lib
LIB_VERSION 0x690
LIB_VERSION_NUMBER 6,9,0,0
LIBRARY_PATH /usr/local/lib/ImageMagick-6.9.0
LIBS -llcms -ltiff -lfreetype -ljpeg -lgs -lpng12 -lfontconfig -lXext -lXt -lSM -lICE -lX11 -lbz2 -pthread -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0 -lxml2 -lz -lm -lgomp
NAME ImageMagick
PCFLAGS -fopenmp -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16
PREFIX /usr/local
QuantumDepth 16
RELEASE_DATE 2014-12-12
SHARE_PATH /usr/local/share/ImageMagick-6
SHAREARCH_PATH /usr/local/lib/ImageMagick-6.9.0/config-Q16
SVN_REVISION 17068
TARGET_CPU x86_64
TARGET_OS linux-gnu
TARGET_VENDOR unknown
VERSION 6.9.0
WEBSITE http://www.imagemagick.org

Path: [built-in]
danfar
Posts: 23
Joined: 2014-12-08T08:22:45-07:00
Authentication code: 6789

Re: PDF to JPG not working from php front end

Post by danfar »

I can call from the front it shows this
Version return code is 0
Version: ImageMagick 6.9.0-0 Q16 x86_64 2014-12-12 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates (built-in): bzlib fontconfig freetype gslib jng jpeg lcms pangocairo png ps tiff x xml zlib
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PDF to JPG not working from php front end

Post by fmw42 »

Delegates (built-in): bzlib fontconfig freetype gslib jng jpeg lcms pangocairo png ps tiff x xml zlib
That would seem to imply that IM can find ghostscript. But did you install the ghostscript fonts also?

Did you try

convert image.pdf image.png

Does that work?
danfar
Posts: 23
Joined: 2014-12-08T08:22:45-07:00
Authentication code: 6789

Re: PDF to JPG not working from php front end

Post by danfar »

it think it worked - whatever we did its working now

FYI there are many sources and things i had to rely and look for e.g.
http://this-is-how-i-did-it.blogspot.co ... ck-on.html
http://mac-dev-env.patrickbougie.com/autoconf/
and a few more depending on your server

thanks again
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PDF to JPG not working from php front end

Post by fmw42 »

Glad to hear that you finally got it to work. Was there anything you found out from the other sources that might help some one else with the same problem?
Post Reply