Problems with pdf to jpg (I already serached the forum)

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
matthewst

Problems with pdf to jpg (I already serached the forum)

Post by matthewst »

This works in terminal

Code: Select all

convert images/image.pdf images/image.jpg
but not in php

So far I have tried:
gave execute permissions to entire site (for testing)
run the command in terminal
set php safemode to off
various php commands:

Code: Select all

exec ("convert images/image.pdf images/image.jpg");

//exec ("usr/local/bin/convert  images/image.pdf[0]  images/image.jpeg");

//$command = "env";
//echo($command);
//system($command);
//echo "<br/><br/>";
//
//$entree = "images/image.pdf";
//$sortie = "images/image.jpg";
//$command = "convert -debug all -verbose $entree $sortie";
//echo($command);
//system($command);
//echo (file_exists($sortie)) ? 1 : 0;
//echo "<br/><br/>";

//exec("/usr/local/bin/convert images/image.pdf images/image.jpg");
I am running apache on xserve using imagemagick v. 6.3.5 and ghostscript v. 8.54 both installed with macports.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Problems with pdf to jpg (I already serached the forum)

Post by Bonzo »

The code below works for me

Code: Select all

// Convert whole pdf document - 3 pages to 3 images
exec("convert instructions.pdf instructions.jpg");
// Convert first page to image
exec("convert instructions.pdf[0] instructions_1.jpg");
Dose this give you any output ?

Code: Select all

exec("convert instructions.pdf instructions.jpg 2>&1", $array); 
echo "<br>".implode($array,"<br>"); 
Out of interest will any other comands work in php ? e.g. resizing a jpg etc.
matthewst

Re: Problems with pdf to jpg (I already serached the forum)

Post by matthewst »

Thanks for the help!!

I got this:

Code: Select all

 dyld: Library not loaded: /usr/X11R6/lib/libdpstk.1.dylib
Referenced from: /usr/local/bin/convert
I then copied libdpstk.1.0.dylib (couldn't find libdpstk.1.dylib) to /usr/X11R6/lib and renamed it the libdpstk.1.dylib

then got this:

Code: Select all

/usr/X11R6/lib/libdpstk.1.dylib: mmap() error 22 at address=0x8AA16000, size=0x00001824 in Segment::map() mapping /usr/X11R6/lib/libdpstk.1.dylib
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Problems with pdf to jpg (I already serached the forum)

Post by Bonzo »

You are beyond me now; I can get the code to run but have no idea how it works !

Hopefuly magick or Anthony can help you out.
matthewst

Re: Problems with pdf to jpg (I already serached the forum)

Post by matthewst »

I searched fot libdpstk.1.1dylib on google and only found people with the same problem I'm having.
matthewst

Re: Problems with pdf to jpg (I already serached the forum)

Post by matthewst »

Has anyone been able to get this to work on OSX?
matthewst

Re: Problems with pdf to jpg (I already serached the forum)

Post by matthewst »

Does anyone have a copy of libdpstk.1.1dylib? Is anyone willing to upload it so I can download it?
matthewst

Re: Problems with pdf to jpg (I already serached the forum)

Post by matthewst »

Magick?...Anthony?...Anyone?...

I could really use some help.
matthewst

Re: Problems with pdf to jpg (I already serached the forum)

Post by matthewst »

:? Hello...
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Problems with pdf to jpg (I already serached the forum)

Post by anthony »

Sorry I don't have MacOSX so can't help. Does it work from the command line?

If yes, then you have a environment problem. like LD_LIBRARY_PATH under UNIX and Linux. But I have no idea for Mac.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply