0

I have a PHP code block I've written that uses imagemagick's convert program (called through exec()) to create thumbnails of uploaded images (originally we tried using the PHP module calls, but kept running into memory errors).

Of course to do this I have to have the full path to convert, which varies from system to system (on my mac it's at /opt/local/bin/convert). I've been just looking it up on the server and setting it in a constant, but this is often less than ideal.

My question is, is there a way to programmatically lookup the install path of convert? I can then just store it in the database or something for quick lookup.

4

1 回答 1

1

如果“convert”在用户的包含路径中,

 $path = `which convert`; 

应该找到它。

于 2009-12-03T20:42:06.510 回答