I am using locally the ImageMagick library for image editing. In my online shared server there was no Imag开发者_StackOverflow社区eMagick installed but after requested, they installed ImageMagick binaries at /usr/local/bin
, e.g. the convert
binary at /usr/local/bin/convert
.
How can I use those binaries in my script?
- Download and install ImageMagick on your local machine.
- Create a test folder with an image or two to play with.
- Open up the shell, go to the test folder, and start playing with the commands until you find a command that gets you the desired results. Consult with the (not-so-helpful) documentation: http://www.imagemagick.org/script/command-line-tools.php
- Paste this command into your php script, replacing any filenames or arguments with php variables as needed.
- exec( // command );
Use exec like
$inputFile = 'file.jpg';
$outputFile = 'file.png';
exec('/usr/local/bin/convert '.$inputFile.' '.$outputFile);
Those aren't "perl binaries", they're the C libraries and binary executables.
You need to build/install the php module that uses them.
精彩评论