|
-
January 20th, 2006, 02:59 PM
#1
CLI + Command = Success; PHP + Command = Failure
Hey Hey,
So as many of you know I've been doing quite a bit of php for work lately.... I know... I hear you groans but don't worry... no code to fix this time....
I'm basically building an image library... but it has to have some quirks.... PDF and EPS files have to be treated as images... (which is part of the reason for the custom development)...
Now I used image magick to do the conversion from the command line during testing..
convert test.eps test.jpg (I could successfully browse to and display that image in my browser)
convert test.pdf test.jpg (This would complete however the graphic would often be CMYK meaning the browser wouldn't convert it and I just recently learned of -colorspace RGB)
So PDFs were done using first gs to output a jpg and then using imagemagick to convert that jpg into a usable PNG for the web... and convert was used for eps... this was all from the command line and everything worked beautifully.
So then I started scripting it in php... I know there's MagickWand for PHP but the lack of documentation (and corrupted help file on the site) make it dificult to use or attempt to use. So I use system calls to execute these commands. First I did the pdf... called the two commands, ended up with a png, deleted the pdf and then swapped the name of the pdf for the name of the png in my array... It's beautiful... it even trims the whitespace.
Then I went to add EPS support.... I'm using the same command as I did on the CLI... CnP even.. It always core dumps...
So here's my question... anyone know why it core dumps? Has anyone heard of a bug in PHP where it can't call some CLI commands properly.... Or a bug in ImageMagick... Would I be better off using system() rather than exec() (which is what I'm currently using)... Or has anyone seen viable documentation for MagickWand?
By the end of today if I haven't made this work.... (I can't really bill the client much more on it)... I'm going to just creating a bash script... I'll call the bash script with the input and output file names and it'll call convert... but I figured since we have the broad user base here that I'd poke around and see if anyone had seen this before.
Peace,
HT
-
January 20th, 2006, 04:29 PM
#2
Oliver's Law:
Experience is something you don't get until just after you need it.
-
January 20th, 2006, 05:02 PM
#3
Hey Hey,
Thanks for the response...
I have to rely on both ghostscript and image magick bceause i'm dealing with postscript files (pdf and eps)... but it may work... I've put a request into my host to install the extension on my server 
Peace,
HT
-
January 21st, 2006, 01:29 AM
#4
I usually just use backticks for command execution in php. It may not give you different results, but it's worth a shot.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|