why can not i run command line in php?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
linjuming
Posts: 122
Joined: 2011-01-25T00:09:50-07:00
Authentication code: 8675308

why can not i run command line in php?

Post by linjuming »

why can not i run command line in php?

Code: Select all

<?php 
	/* 
		i want to use comand line to compress image in php
		this code bellow works in cmd but does not works in php
	*/
	
	// in cmd type and run is ok
	// convert -strip -quanlity 75% 0.jpg 00.jpg
	
	// in php does not works
	shell_exec('convert -strip -quanlity 75% 0.jpg 00.jpg');
	// or
	exec('convert -strip -quanlity 75% 0.jpg 00.jpg');
	
	// but this is ok:
	exec('convert -strip 0.jpg 00.jpg');
	
	// why?

	
 ?>
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: why can not i run command line in php?

Post by Bonzo »

A couple of things I see:
-quanlity should be -quality
-quality is between 1 and a 100 not 1% and 100%
The image is read in first and so it should be: exec('convert 0.jpg -strip -quality 75 00.jpg');
linjuming
Posts: 122
Joined: 2011-01-25T00:09:50-07:00
Authentication code: 8675308

Re: why can not i run command line in php?

Post by linjuming »

thank you very much !
Post Reply