Page 1 of 1

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

Posted: 2007-08-20T07:36:44-07:00
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.

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

Posted: 2007-08-20T08:37:22-07:00
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.

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

Posted: 2007-08-20T09:10:43-07:00
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

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

Posted: 2007-08-20T09:29:38-07:00
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.

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

Posted: 2007-08-20T10:01:36-07:00
by matthewst
I searched fot libdpstk.1.1dylib on google and only found people with the same problem I'm having.

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

Posted: 2007-08-20T10:56:29-07:00
by matthewst
Has anyone been able to get this to work on OSX?

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

Posted: 2007-08-21T04:46:27-07:00
by matthewst
Does anyone have a copy of libdpstk.1.1dylib? Is anyone willing to upload it so I can download it?

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

Posted: 2007-08-21T08:13:16-07:00
by matthewst
Magick?...Anthony?...Anyone?...

I could really use some help.

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

Posted: 2007-08-22T05:37:07-07:00
by matthewst
:? Hello...

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

Posted: 2007-08-22T21:39:33-07:00
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.