I have an application which was developed using php
and I want to print a dithering image through my printer so what I am doing is I have an application called ImageMagick. In this application using command prompt I will pass an image path and the destination folder. So when I run the command in the command prompt it will convert the image and save it in destination folder.
Firstly I tried the php exec()
for the below code
<?php
echo exec('ipconfig');
?>
The above code gives the output on the browser
When I give the below code:
<?php
echo exec('date');
?>
It gives the output as below
Enter the new date: (mm-dd-yy)
But When I run the date
command on the command prompt it gives the current date
I tried to run the Imagemagick command in php
code as shown below
<?php
echo exec('convert "C:\bhargav\dev\download.jpg" -resize 384 -dither FloydSteinberg -remap pattern:gray50 "C:\bhargav\dev\con.jpg"');
?>
But it doesn't save any image as output and no error is shown on the browser.
convert "C:\bhargav\dev\download.jpg" -resize 384 -dither FloydSteinberg -remap pattern:gray50 "C:\bhargav\dev\con.jpg"
when the above command is given in the command prompt it gives me the output.
Where am I going wrong?