Sebastien
Sebastien

Reputation: 6660

Error using imagemagick on mamp

I am trying to convert a pdf to jpeg. So i created a bash file :

#!/bin/sh
/usr/local/bin/convert "ODR20120641.pdf" "document.jpg" 2>&1

But i got this error message:

convert: missing an image filename `document.jpg' @ error/convert.c/ConvertImageCommand/3015.

I am on lion, and i installed imagemagick using homebrew. When i run this command in the terminal, every thing works fine. But when i use php, it fails :

$return = exec('./generate');
var_dump($return);

Upvotes: 0

Views: 216

Answers (1)

Bonzo
Bonzo

Reputation: 5299

As you have access to php what happens if you run the code directly using exec? The error is probably not with document.jpg but a problem with finding or modifying the pdf file.

$array=array(); 
echo "<pre>"; 
exec("/usr/local/bin/convert ODR20120641.pdf document.jpg 2>&1", $array);  
echo "<br>".print_r($array)."<br>";  
echo "</pre>"; 

Upvotes: 1

Related Questions