How to use php and ImageMagick
Posted: 2017-08-02T05:32:53-07:00
				
				Code: Select all
<?php
$input = realpath("image.jpg");
$g = exec("convert $input image.png"); 
if ($g){
	echo "yes";
}else{
	echo"is not working";
}
?>
Use https://github.com/ImageMagick/ImageMagick/discussions instead.
https://imagemagick.org/discourse-server/
https://imagemagick.org/discourse-server/viewtopic.php?t=32436
Code: Select all
<?php
$input = realpath("image.jpg");
$g = exec("convert $input image.png"); 
if ($g){
	echo "yes";
}else{
	echo"is not working";
}
?>
Code: Select all
exec("convert input.jpg output.png", $output, $return); 
if ($return == "0") { echo '<br>Image generation sucssesful<br>'; } 
else { echo '<br>Image generation failed<br>'; } 
noted, i guess you're OK now, so could please help me.Bonzo wrote: 2017-08-02T07:22:02-07:00 This is not a php forum ( Imagick is an external program and so might not return anything to php ) and "Question" is a useless title as you have at least two threads with the same title.
Try basing your code on this example:Code: Select all
exec("convert input.jpg output.png", $output, $return); if ($return == "0") { echo '<br>Image generation sucssesful<br>'; } else { echo '<br>Image generation failed<br>'; }
 
   
   
   
   
   wow my image magick is now working like a charm . i changed the convert to magick as suggested by fmw42. I thank every one that has reply my "useless Question" like Bonzo would call. thanks Bonzo, snibgo and  fmw42. great community indeed.
  wow my image magick is now working like a charm . i changed the convert to magick as suggested by fmw42. I thank every one that has reply my "useless Question" like Bonzo would call. thanks Bonzo, snibgo and  fmw42. great community indeed.Code: Select all
exec("magick input.jpg output.png", $output, $return); 
if ($return == "0") { echo '<br>Image generation sucssesful<br>'; } 
else { echo '<br>Image generation failed<br>'; }
I do not use Windows, but you should be able to set up a symbolic link to map convert to magick. One of the Windows users would have to help.dt59 wrote: 2017-08-02T10:42:45-07:00 does it mean i have to change all the convert in code to magick? but why