Oleksandr IY
Oleksandr IY

Reputation: 3116

Imagemagic and php exec: convert: no images defined

The command works just fine from the shell

/opt/ImageMagick/bin/convert /private/var/folders/nl/9cky1krj5_j7zwm34tfkndd40000gn/T/pdfPyflQF /private/var/folders/nl/9cky1krj5_j7zwm34tfkndd40000gn/T/imgRilIdW 2>&1

I got image generated. But if I run it with php exec function I get error

Array
(
    [0] => convert: no images defined `/private/var/folders/nl/9cky1krj5_j7zwm34tfkndd40000gn/T/imgRilIdW' @ error/convert.c/ConvertImageCommand/3212.
)

Seems it's not permission issue. File permissions are 666. Can't figure out what is wrong.

Upvotes: 0

Views: 538

Answers (2)

Bonzo
Bonzo

Reputation: 5299

I can not see a file extension on the input or output images.

It would probably be worth enclosing your image path in " " and what actual code are you using in exec()

Upvotes: 0

Pavel Tkachenko
Pavel Tkachenko

Reputation: 31

Usually error "convert: no images defined" is coming when convert couldn't find gs tool.

I had the same problem and solved it with defining PATH environment before doing shell_exec like this:

putenv('PATH=/usr/local/bin:/usr/bin:/bin:/opt/local/bin/');

Because gs tool is located in the /opt/local/bin.

Upvotes: 1

Related Questions