I'm trying to make ImageMagick work in a PHP script. On the command-line, it works fine. I guessed it was maybe due to convert
not being detected because ImageMagick is installed in the C:\\xampp
folder. What could be going wrong?
<?php
$path ='C:/xampp/';
$image ='_media/4055-Beckman-Lead-App/client/fpo.pdf';
$png ='_media/4055-Beckman-Lead-App/client/Capture.PNG';
if(file_exists($png)){
echo $png;
exec($path.'convert'. $png .'_media/4055-Beckman-Lead-App/client/fpo.png');
}
else {
echo "file doesn't exist";
}
You need a space between convert
and the first PNG file name, and between the first and second PNG file names:
exec($path . 'convert ' . $png . ' _media/4055-Beckman-Lead-App/client/fpo.png');
The .
operator in PHP just sticks two strings together, without adding extra space.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.